开发者

Loop through all cells in a Excel Column to the end

开发者 https://www.devze.com 2023-02-14 21:49 出处:网络
Probably simple once i see the correct code but what is the best w开发者_StackOverflow社区ay to loop through a specific column in a worksheet until the end?It\'s pretty simple. Just create a range obj

Probably simple once i see the correct code but what is the best w开发者_StackOverflow社区ay to loop through a specific column in a worksheet until the end?


It's pretty simple. Just create a range object that points to the range you want to start at, then loop through each offset from that range until you get to a blank cell.

int i = 0;

while (target_range.Offset(i, 0).Value != "")
{
    i++;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消