Skip to content

Instantly share code, notes, and snippets.

@ateneva
Created January 9, 2018 01:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ateneva/41cfadc917c477e3b471790443805bd5 to your computer and use it in GitHub Desktop.
Save ateneva/41cfadc917c477e3b471790443805bd5 to your computer and use it in GitHub Desktop.
Find the height and width of an Excel shape
Sub ShowShapeDimensions()
Dim l As Long
Dim t As Long
Dim h As Long
Dim w As Long
Dim Sh As Shape
'----------------------------------------------
For Each Sh In ActiveSheet.Shapes
If Sh.TopLeftCell.Address(0, 0) = "B2" Then
l = Sh.Left
t = Sh.Top
h = Sh.Height
w = Sh.width
End If
Next Sh
'Return Dimensions
ActiveSheet.Range("A1") = "Left: " & l
ActiveSheet.Range("A2") = "Top: " & t
ActiveSheet.Range("A3") = "Height: " & h
ActiveSheet.Range("A4") = "Width: " & w
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment