how to get the relative position of shapes within a worksheet

倖福魔咒の 提交于 2019-12-23 20:26:47

问题


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


回答1:


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


来源:https://stackoverflow.com/questions/22773816/how-to-get-the-relative-position-of-shapes-within-a-worksheet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!