Making changes to worksheet buttons in Excel clears the undo stack

jackms

New Member
Joined
Dec 28, 2005
Messages
35
Office Version
  1. 2016
Platform
  1. Windows
I have some buttons an Excel sheet and and I have VBA code that changes a property of a button based on user actions.
The problem is, once VBA changes the button property, it considers it a worksheet change and clears the Undo stack.
I know there's no way to prevent VBA from clearing the Undo stack when making a change to a sheet, but perhaps I can make the button's parent some object other than the worksheet? Or any other ideas?
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Maybe try this?
VBA Code:
Application.EnableEvents = False

'(Your code to change the button)

Application.EnableEvents = True
 
Upvote 0
Thanks. But that doesn't do the trick. The undo stack still gets cleared.
 
Upvote 0
What sort of button is it & what are you changing?
 
Upvote 0
It's actually a Group made up of Buttons and a GroupBox. The Buttons and GroupBox are the ones you get from the "Form Controls" section in Developer -> Insert

Capture.PNG



I change .Left / .Top / .Title for the Group. A change to any of those clears the undo stack
 
Upvote 0
Thanks for that, unfortunately I don't know of any of moving the buttons without clearing the undo stack.
 
Upvote 0

Forum statistics

Threads
1,224,900
Messages
6,181,631
Members
453,059
Latest member
jkevin

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