且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在VBA excell宏的range语句中使用变量

更新时间:2023-01-19 17:12:18

您可以将Range方法与&运算符,将变量连接到字符串中:

You could use the Range method with the & operator to join the variable into a string:

Range("A" & r)

或者,您可以使用带有参数(行,列) 的Cells方法:

Alternately you can use the Cells method which takes arguments (Row, Column):

Cells(r, "A")