How to get the size of a range in Excel

前端 未结 2 1153
灰色年华
灰色年华 2021-01-03 20:33

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

2条回答
  •  再見小時候
    2021-01-03 20:49

    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
    

提交回复
热议问题