我正在尝试应用' For loop'在excel VBA中,我必须转到2号,8号,15号,21号,28号,35号,49号,56号,63号,70号,76号;由于没有固定的模式/序列,我无法使用Step命令,我应该怎么做呢?
答案 0 :(得分:3)
使用数组并循环遍历它。
dim vars as variant, v as long
vars = array(2, 8, 15, 21, 28, 35, 49, 56, 63, 70, 76)
for v = lbound(vars) to ubound(vars)
'do something with cells(vars(v), <some column>) or cells(<some row>, vars(v))
next v