Macro Button moves on Save - How to pin location?

IndyRacer

New Member
Joined
Jul 8, 2005
Messages
23
I am using Excel 2010 and have a file with several Form Control Buttons to run Macros. The buttons are located on multiple sheets throughout the file, with each button assigned a specific macro. The problem is that I cannot pin the button location to a particular spot on the worksheet. I can place the button where I want it, but when I save the file and then reopen it, the buttons move to approx. the middle of the sheet (laterally). Does anyone know how to pin the button location to a particular area or cell? I have tried going to the button's Properties and checking "Don't move or size with cells" but this doesn't help. Any suggestions?
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
You can move and resize buttons by setting their .Top, .Left, .Width and .Height properties using the corresponding properties of one or more worksheet cells.

Example, to fix Button 1 to cell H1:-
Code:
[FONT=Fixedsys]  With ActiveSheet
    .Shapes("Button 1").Top = .Range("H1").Top
    .Shapes("Button 1").Left = .Range("H1").Left[/FONT]
[FONT=Fixedsys]    .Shapes("Button 1").Width = .Range("H1").Width[/FONT]
[FONT=Fixedsys]    .Shapes("Button 1").Height = .Range("H1").Height [/FONT]
[FONT=Fixedsys]  End With
[/FONT]
To fix it to H1:I2 with a bit of a border:-
Code:
[FONT=Fixedsys]  With ActiveSheet
    .Shapes("Button 1").Top = .Range("H1").Top + 4
    .Shapes("Button 1").Left = .Range("H1").Left + 4
    .Shapes("Button 1").Width = .Range("H1").Width + .Range("I1").Width - 8
    .Shapes("Button 1").Height = .Range("H1").Height + .Range("H2").Height - 8[/FONT]
[FONT=Fixedsys]  End With
[/FONT]
 
Upvote 0

Forum statistics

Threads
1,224,520
Messages
6,179,267
Members
452,902
Latest member
Knuddeluff

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