VBA to re-position shapes

ExcelWhizzDotCom

New Member
Joined
Dec 31, 2015
Messages
11
Hi all, can any VBA whizzes help me out?

I'm trying to programmatically maintain the position of autoshapes on my worksheet, one of the routines re-sizes column widths but I want to write into it something which remembers their position at the start of the routine and puts them back after the column widths are changed.

I've tried something simple:

Code:
    ActiveSheet.Shapes.SelectAll
    Selection.ShapeRange.IncrementLeft 10000

And then at the end move it back -10000. But the problem is if overall widths have reduced, the -10000 step takes everything too far to the left.

If anyone has a solution it'd be gratefully received!

Thanks
CW
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hi,

Have you tried setting the "Don't move or size with cells" property on the format tab for each shape?

Is that what you are trying to do?

Regards,
 
Upvote 0
No problem.

There is so much buried in the way of options and settings in Excel I don't think anyone can keep track of all of them.

The skill lies in knowing when it is worth looking. ;)

Regards,
 
Upvote 0

Forum statistics

Threads
1,223,993
Messages
6,175,836
Members
452,674
Latest member
psion2600

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