热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

确定合并区域的大小-Determiningthesizeofamergedarea

Right,beforewegetoffaboutmergedcells,Ihatethemtoo,butIvetodealwiththemanyway.Ic

Right, before we get off about merged cells, I hate them too, but I've to deal with them anyway. I cannot change anything about that now or in the future. As much as I would like to ;)

是的,在我们关于合并细胞之前,我也讨厌它们,但无论如何我都要处理它们。我现在或将来都无法改变这一点。我想尽可能多;)

Say I have some merged cells, I need to determine the amount of cells it spans. Say A1:A4 are merged, then I need to have the number of merged cells, 4, returned. Is there any way to accomplish this?

假设我有一些合并的细胞,我需要确定它跨越的细胞数量。说A1:A4合并,然后我需要返回合并单元格的数量4。有没有办法实现这个目标?

2 个解决方案

#1


6  

You can use

您可以使用

Dim r As range
Dim i As Integer
    Set r = range("A1")
    i = r.CurrentRegion.Count

This will give A1:A4 as 4, A1:B4 as 8.

这将给A1:A4为4,A1:B4为8。

#2


9  

ActiveCell.MergeArea.Count

推荐阅读
author-avatar
小豇豆和花椰菜
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有