Yep, I'm still trying to find an angle on automating alignment of Drawing Objects and shapes.
I don't want to manually check. I found code for shapes here:
http://www.mrexcel.com/forum/excel-...ic-applications-absolute-x-y-coordinates.html
But I don't want anything touched if they are in the right position as determined by fixed value list or the values of same objects in another sheet.
IF(Shape1)=Sheet1!oShape1.Top DO NOTHING
OR if the shapes don't match position move it.
Public Sub Test()
Dim oShape As Shape
Set oShape = ActiveSheet.Shapes("Rectangle 1")
oShape.Top = 200
oShape.Left = 200
'or
'Move shape to top left corner of cell E10
Dim oCell As Range
Set oCell = ActiveSheet.Range("E10")
oShape.Top = oCell.Top
oShape.Left = oCell.Left
End Sub
I don't want to manually check. I found code for shapes here:
http://www.mrexcel.com/forum/excel-...ic-applications-absolute-x-y-coordinates.html
But I don't want anything touched if they are in the right position as determined by fixed value list or the values of same objects in another sheet.
IF(Shape1)=Sheet1!oShape1.Top DO NOTHING
OR if the shapes don't match position move it.
Public Sub Test()
Dim oShape As Shape
Set oShape = ActiveSheet.Shapes("Rectangle 1")
oShape.Top = 200
oShape.Left = 200
'or
'Move shape to top left corner of cell E10
Dim oCell As Range
Set oCell = ActiveSheet.Range("E10")
oShape.Top = oCell.Top
oShape.Left = oCell.Left
End Sub
Last edited: