Asbolute Ref: Can I use Shape Code in a Compare? Move only if not match to fixed values?

pete234

Active Member
Joined
Feb 10, 2004
Messages
419
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
 
Last edited:

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,214,875
Messages
6,122,042
Members
449,063
Latest member
ak94

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top