![在 Excel 宏中查找并替换增量](https://linux22.com/image/1518370/%E5%9C%A8%20Excel%20%E5%AE%8F%E4%B8%AD%E6%9F%A5%E6%89%BE%E5%B9%B6%E6%9B%BF%E6%8D%A2%E5%A2%9E%E9%87%8F.png)
我想在所有工作表中替换 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