Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 VBA 中有一个小问题,我想将 Range 函数的行和列以 String 格式放置,如下所示:
debut = "BH" & LTrim(Str(i)) fin = "DB" & LTrim(Str(i)) For Each Cell In Ws.Range("debut:fin")
但是我有一个错误,我该如何解决?谢谢
你做的方式("debut:fin"),范围真的等于那个字符串并且是无效的。您需要做的是将 2 个字符串与运算符:之间的a 连接起来&:
"debut:fin"
:
&
For Each Cell In Ws.Range(debut & ":" & fin)