yoshiserry
yoshiserry

Reputation: 21395

how to get the relative position of shapes within a worksheet

If you think of cells, we know logically that Row 2 is higher than row 100.

However If I had two shapes (lets say circles) how do I determine which one is higher than the other, or further left than the rest?

UPDTAE

enter image description here

Upvotes: 4

Views: 20561

Answers (1)

Gary's Student
Gary's Student

Reputation: 96791

Here is some code to display the row for each Shape:

Sub dural()
    Dim s As Shape, mesage As String
    For Each s In ActiveSheet.Shapes
        mesage = mesage & vbCrLf & s.Name & "---" & s.TopLeftCell.Row
    Next s
    MsgBox mesage
End Sub

Upvotes: 4

Related Questions