在 Excel 宏中查找并替换增量

在 Excel 宏中查找并替换增量

我想在所有工作表中替换 excel 公式中的一个值,但每个工作表中的值都会增加 1

我尝试过这些宏但它会以相同的值改变

Sub FindReplaceAll()
'PURPOSE: Find & Replace text/values throughout entire workbook

Dim sht As Worksheet
Dim fnd As Variant
Dim rplc As Variant
Dim p As Integer
Dim q As Integer
p = 3
q = p + 1
fnd = "$3"
rplc = "$" & q

For Each sht In ActiveWorkbook.Worksheets
  sht.Cells.Replace what:=fnd, Replacement:=rplc, _
    LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
    SearchFormat:=False, ReplaceFormat:=False
Next sht
p=q
End Sub 

相关内容