读取直到Excel文件中的最后一行. [英] Reading until the last line in an excel file.

查看:106
本文介绍了读取直到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


这篇关于读取直到Excel文件中的最后一行.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆