4

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

  • Where is the Object model for all Objects and methods / attributes for things like 1. charts >> The Top left

enter image description here

yoshiserry
  • 20,175
  • 35
  • 77
  • 104
  • 2
    Look at the shape object's `.TopLeftCell.Address` – tigeravatar Mar 31 '14 at 23:08
  • but are shapes always aligned to cells, or can they be free. I am skilled with VBA but I have never been able to find a full OBJECT MODEL for VBA listing all the objects (wksht, wb, shapes, charts, pivot, etc) only bits and pieces from other peoples tutorials. – yoshiserry Mar 31 '14 at 23:12
  • 3
    Not aligned, but it does know what the top-left-most cell the shape occupies is. You can use that as a reference. If you'd rather not use cell references, shapes also have `.Top` and `.Left` properties. 0 indicates the shape is all the way at top, or all the way at left – tigeravatar Mar 31 '14 at 23:14
  • The answer [here](http://stackoverflow.com/a/22731978/2521004) might help you. – Automate This Mar 31 '14 at 23:30
  • [Excel Object Model](http://msdn.microsoft.com/en-us/library/office/ff194068(v=office.14).aspx). You should be able to drill down in to any of the pieces, like [Chart object members](http://msdn.microsoft.com/en-us/library/office/ff837379(v=office.14).aspx) (i.e., methods and properties), or the [Shape object](http://msdn.microsoft.com/en-us/library/office/ff193908(v=office.14).aspx), etc. – David Zemens Apr 01 '14 at 01:05

1 Answers1

4

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
Gary's Student
  • 95,722
  • 10
  • 59
  • 99