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

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
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,223,950
Messages
6,175,582
Members
452,653
Latest member
craigje92

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