如何计算的行Excel中的一些数据? [英] How to count the number of rows in excel with data?

查看:174
本文介绍了如何计算的行Excel中的一些数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

A列有这样的(即频繁的空白单元格)数据:

 标题为LT;  - 这是A1
kfdsl
fdjgnm
fdkj

gdfkj
4353

fdjk<  - 这是A9
 

我希望能够得到有数据的最后一个单元格的单元格引用。所以在上面的例子中,我想回: A9

我也试过,但它在第一个空白单元格为止(即返回 A4

  numofrows = destsheet.Range(A2)结束(xlDown).Row  -  1
 

解决方案

我喜欢这种方式:

ActiveSheet.UsedRange.Rows.Count

同样可以做到的列数。对我来说,总是工作。但是,如果你有在其他列中的数据,在code以上会考虑这些事情,因为code正在寻找所有单元格范围的表。

column A has data like this (ie frequent blank cells):

HEADING  <-- this is A1
kfdsl
fdjgnm
fdkj

gdfkj
4353

fdjk  <-- this is A9

I would like to be able to get the cell reference of the last cell that has data. So in the above example I want to return: A9

I have tried this but it stops at the first blank cell (ie returning A4)

numofrows = destsheet.Range("A2").End(xlDown).Row - 1

解决方案

I like this way:

ActiveSheet.UsedRange.Rows.Count

The same can be done with columns count. For me, always work. But, if you have data in another columns, the code above will consider them too, because the code is looking for all cell range in the sheet.

这篇关于如何计算的行Excel中的一些数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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