VBA to move and resize command buttons

volkl77

Board Regular
Joined
Apr 5, 2008
Messages
76
Hi all,

I have a set of inventory workbooks (20 different files with the exact same layout and sheet names) with command buttons on the individual sheets to run macros. I have tried every possible solution that I can find online to prevent the buttons from being moved and resized (don't move or resize, lock aspect ratio, print object, & protect worksheet and button) but somehow they are still getting moved and resized. Is there a way to write a macro that will select each individual button, resize it and move them to a specific location on each sheet? I have tried using the record macro option but when I try and run on different sheets it fails. Besides driving me crazy, the buttons are sometimes being resized so small that they can't be clicked and I have to go in and fix the sheet.:oops:

Any help would be greatly appreciated!

Thanks!
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Hi all,

I have a set of inventory workbooks (20 different files with the exact same layout and sheet names) with command buttons on the individual sheets to run macros. I have tried every possible solution that I can find online to prevent the buttons from being moved and resized (don't move or resize, lock aspect ratio, print object, & protect worksheet and button) but somehow they are still getting moved and resized. Is there a way to write a macro that will select each individual button, resize it and move them to a specific location on each sheet? I have tried using the record macro option but when I try and run on different sheets it fails. Besides driving me crazy, the buttons are sometimes being resized so small that they can't be clicked and I have to go in and fix the sheet.:oops:

Quick question - do you have design mode enabled? I have a similar spreadsheet where the command buttons are used primarily for navigation throughout the sheet, and the only way I can move/resize etc is to have design mode enabled.

Just a thought...
 
Upvote 0
Hi All,
I had the same problem. Fixed it with a simple little bit of code.
Sub FixSize ()
With CommandButtonX
.height = 24
.width = 80
End With

Have this run on start up on the CommandButtonX code
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,843
Members
449,051
Latest member
excelquestion515

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