请原谅我的无知,但我需要以下代码的帮助
Sub D3()
Dim currentRow As String
Dim sTemp As String
sTemp = Range("D3").Formula 'cell in sheet that needs reference to be increased
Do While (IsNumeric(Right(sTemp, 1)))
currentRow = Right(sTemp, 1) & currentRow
sTemp = Mid(sTemp, 1, Len(sTemp) - 1)
Loop
currentRow = CLng(currentRow) + 1 'Number to increment cell reference by
Range("D3").Formula = sTemp & currentRow
End Sub
由于我忘记了大部分编码,并且我认为这是一个简单的解决方案,因此我去谷歌并获得了上面的代码。它在单个单元格上运行良好,但我希望能够更新从 D3 到 D29 的一系列单元格中的公式,这就是我陷入困境的地方。
我试过了
sTemp = Range("D3:D29").Formula
没有运气。
我目前可以获得我想要的唯一方法是创建 120ish 宏并在主宏中运行它们 - 我相信你会同意这不是很有效。
我希望能够轻松地将解决方案应用于工作表中的其他列。
谢谢