0
我是VBA /宏編碼的新手。嘗試在RC引用中插入一個變量,但它不起作用。我不知道我在哪裏犯了一個錯誤,任何指導表示讚賞。在excel中使用變量RC參考
Dim var1 As Integer
Dim var2 As Integer
var1 = 1 'this changes dynamically in my actual program
var2 = 2 'this changes dynamically in my actual program
Range("A2").Select
'following doesn't work
ActiveCell.FormulaR1C1 = "=RC[var1]/RC[var2]"
'following works
ActiveCell.FormulaR1C1 = "=RC[1]/RC[2]"