对excel单元格进行统计——Count属性
时间:2023-09-12 22:36:54
在我们需要统计工作表中某区域的单元格数或者行列数时,就要用到Count属性。Count属性代表单元格对象的数目,下面举例来说明该属性的一些使用。
在工作表中,可以很清楚地看出单元格区域A1:C2共有6个单元格,占据2行3列。在VBA中,可以使用下面列出的代码返回单元格区域A1:C2所占有的单元格数及行列数。
下面的代码:
Range(“A1:C2”).Count
返回值6,表示单元格区域A1:C2中共有6个单元格。
下面的代码:
Range(“A1:C2”).Rows.Count
返回值2,表示单元格区域A1:C2共有2行。
下面的代码:
Range(“A1:C2”).Columns.Count
返回值3,表示单元格区域A1:C2共有3列。
下面的代码统计一张工作表的总行数:
Rows.Count
在Excel 2007及以上版本中,返回值为1048576。
下面的代码统计一张工作表的总列数:
Columns.Count
在Excel 2007及以上版本中,返回值为16384。
下面的代码统计工作表中总的单元格数:
Cells.Count
但发生溢出错误,因为工作表中的单元格数目太多,超过了Count属性返回值的范围。一般情况下,使用Count属性统计单元格对象数目不会有太大的问题,除非您想统计的单元格数目太大,超出了Count属性允许的范围。
标签:Excel函数,excel函数公式,excel表格制作,Excel教程
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
windows7怎么设置屏幕保护?
2023-06-16 18:21:46
![](https://img.aspxhome.com/file/2023/1/a279185_0s.jpg)
Win7标准版和家庭版如何添加PowerShell工具
2022-10-30 11:58:09
![](https://img.aspxhome.com/file/2023/27/a233499_0s.jpg)
Win11系统怎么隐藏文件夹?Windows11如何隐藏某个文件夹?
2022-05-16 22:23:20
![](https://img.aspxhome.com/file/2023/27/a237187_0s.jpg)
现在什么电脑系统最好用流畅_最好用流畅的电脑系统推荐
2023-12-04 16:50:36
![](https://img.aspxhome.com/file/2023/2/a286643_0s.jpg)
价格疯涨!内存/SSD终于刹住车
2022-11-08 14:18:19
![](https://img.aspxhome.com/file/2023/2/a286081_0s.jpg)
Windows10系统搜索栏卡顿的处理方法
2022-06-29 19:41:53
![](https://img.aspxhome.com/file/2023/26/a227757_0s.jpg)
如何在Mac电脑的QQ中修改文件保存位置?
2022-04-08 14:26:03
![](https://img.aspxhome.com/file/2023/0/a202910_0s.jpeg)
win11游戏闪退黑屏的两种解决方法
2023-01-11 16:37:36
![](https://img.aspxhome.com/file/2023/30/a266446_0s.jpg)
游戏FPS帧数很低怎么办 FPS不稳定的原因及解决方法
2023-01-26 20:15:26
![](https://img.aspxhome.com/file/2023/1/a273722_0s.png)
作为下载工具的迅雷 for Mac免登陆离线会员加速支持磁力Thunder种子链接高速下载完美版测评
2022-12-07 04:40:17
![](https://img.aspxhome.com/file/2023/6/a212156_0s.jpeg)
电脑网卡不仅仅是指有线网卡,还有无线网卡和蓝牙
2023-09-16 04:10:51
![](https://img.aspxhome.com/file/2023/9/a343617_0s.jpg)
如何在Mac上将桌面和文档文件夹同步到iCloud?
2022-10-21 14:40:19
![](https://img.aspxhome.com/file/2023/9/a207949_0s.jpeg)
如何利用 excel 批量制作贺卡,自动识别男女,还能群发邮箱!
2022-03-29 05:10:03
![](https://img.aspxhome.com/file/2023/1/a154331_0s.jpg)
Excel2013中怎么将两类数据绘制在同一张图表中?
2022-05-12 12:21:55
![](https://img.aspxhome.com/file/2023/9/a141589_0s.jpg)
Win10两台电脑怎么连接局域网?
2022-04-17 20:52:54
![](https://img.aspxhome.com/file/2023/26/a222335_0s.png)
Windows10 TH2系统标题栏颜色怎么更改 win10系统标题栏修改成彩色步骤
2022-08-03 03:27:40
![](https://img.aspxhome.com/file/2023/28/a246328_0s.png)
PS CS6简体中文版怎么安装?
2023-10-13 06:24:23
![](https://img.aspxhome.com/file/2023/9/a341657_0s.png)
win7电脑如何测试麦克风有没有声音?
2023-08-07 10:52:06
![](https://img.aspxhome.com/file/2023/30/a265120_0s.jpg)
喜马拉雅的xm音频如何转换mp3格式教学分享
2022-05-24 05:42:49
![](https://img.aspxhome.com/file/2023/7/a327222_0s.png)
Win11电脑CPU锁频怎么办? Win11解除CPU锁频的解决方法
2023-08-08 14:44:48
![](https://img.aspxhome.com/file/2023/30/a263774_0s.jpg)