Tuesday, January 1, 2019

Get Height and Width of a Cell in Excel

Private Sub Worksheet_Activate()
    Dim getHeight As Single
    Dim getWidth As Single
   
    For i = 1 To 10
        getHeight = Range("A" + Trim(Str(i))).Height
        getWidth = Range(Chr(65 + i) + "1").Width
     
        Me.UsedRange(i, 1) = "Row  cm : " + Str(Round((getHeight / 72) * 2.54, 2))
        Me.UsedRange(1, i + 1) = Chr(65 + i) + "1 :" + Str(Round((getWidth / 72) * 2.54, 2))
     
    Next
End Sub

No comments:

Post a Comment

Your feedback is always appreciated. I will try to reply to your queries as soon as time allows.Please don't spam,spam comments will be deleted upon reviews.