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

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Watch MrExcel Video

Forum statistics

Threads
1,132,785
Messages
5,655,290
Members
418,186
Latest member
mrahim

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
Top