gpt4 book ai didi

excel - VBA如何遍历Excel中的列

转载 作者:行者123 更新时间:2023-12-04 21:41:27 25 4
gpt4 key购买 nike

我知道起始单元格,我需要通过列向下走。当下一个单元格为空时,我需要退出循环。如何在 VBA 代码中做到这一点?

感谢您的回复

最佳答案

怎么样;

'//get a range from anchor cell (a1) to the 1st empty cell in the same column;
dim r As Range, cell as Range
set r = Range(Range("A1"), Range("A1").End(xlDown))

'//loop it
for Each cell In r
msgbox cell.Value
next

关于excel - VBA如何遍历Excel中的列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7512843/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com