如何获得工作表中形状的相对位置 [英] how to get the relative position of shapes within a worksheet
本文介绍了如何获得工作表中形状的相对位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果您想到的是单元格,则从逻辑上我们知道第2行高于第100行.
但是,如果我有两个形状(用圆圈表示),如何确定哪个形状比另一个形状高,或者比其他形状更左?
UPDTAE
- 哪里是所有对象的对象模型以及诸如1.图表>>左上方 之类的方法/属性
解决方案
下面是一些代码,用于显示每个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
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
解决方案
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
这篇关于如何获得工作表中形状的相对位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文