0
For i = 1 To 5
changeto = CStr(Sheet15.Cells(1, i).Formula)
newindustry = getfirstword(Worksheets("Industry Insert Template").Range("C1"))
'grab the index position of the comma and exclamation mark
intchangeto = InStr(changeto, ",")
finalchangeto = InStr(changeto, "!")
'extract the worksheet substring
finalindustry = Mid(changeto, intchangeto + 1, finalchangeto - intchangeto - 1)
If finalindustry <> "'Multiples & EPS'" And finalindustry <> "Technicals" Then
finalformula = Replace(changeto, finalindustry, newindustry)
Cells(1, i).Formula = finalformula
End If
Next
目前这是我的宏来调整工作表名称。
我只想调整数字参考。
替换公式VBA的数字参考?
例如:
=VLOOKUP($B1,Industrials!$CA$41:$GG$41,C$8)
我希望能够改变细胞41在VLOOKUP,以反映正确的行。
我将如何检查所有细胞并更改公式来反映这一点?
更好的使用它使用命名范围。这就是他们在那里。 – ja72 2014-12-05 21:33:03
你可以看看使用R1C1风格的地址:用'.FormulaR1C1'在VBA中访问 – Captain 2014-12-14 18:51:25