读取直到Excel文件中的最后一行.
问题描述:
大家好,
我如何使我的宏读取行,直到其中包含一些值.
IE;现在,我指定一个值范围,例如(范围A1:A1000).但并非总是有1000个值.可以是800或1200.
在这种情况下,如何在宏中编码,以便程序到达没有值的行时立即停止?
请需要帮助.
Hi all,
How can I make my macro read the line until it has some values in it.
Ie; Now I specify a range of values, say(Range A1:A1000). But not always there are 1000 values. There can be a 800 or 1200.
In this case how do I code in macro such that as soon as the program reaches a line with no values, it stops?
Need some help please.
答
使用以下代码,而 count 将使行的末尾具有值
范围("A1").选择
Range(Selection,Selection.End(xlDown)).Count
use below code and the count will give end of row having value
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Count