How to get the size of a range in Excel

此生再无相见时 提交于 2019-12-05 12:19:32

问题


Using VBA, is it possible to get the size of a given range in terms of pixels or units? (I don't care which unit as I am only using it to relate to other measurements with the same unit).

Thanks.


回答1:


The overall dimensions of a range are in its Width and Height properties.

Dim r As Range
Set r = ActiveSheet.Range("A4:H12")

Debug.Print r.Width
Debug.Print r.Height



回答2:


The Range object has both width and height properties, which are measured in points.



来源:https://stackoverflow.com/questions/2237873/how-to-get-the-size-of-a-range-in-excel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!