Undo/Redo not working after running VBA

kowolo

New Member
Joined
Sep 28, 2009
Messages
39
I have a spreadsheet that runs a VBA code for conditional formatting. The code works fine, but now undo/redo/repeat, etc. are disabled for the entire workbook (even the cells that are not in the range for the conditional formatting).

All my other Excel files are fine so this is not a program-wide issue. Just this file is affected.

Is there anyway I can reenable these functions?

Kolette
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Once a macro makes a change to the environment (changes a cell value, a format, almost anything), the Undo stack is flushed. It's a good reason to be circumspect about adding VBA (other than UDFs) to a worbook.
 
Upvote 0
Is there a better way to add multiple conditions? I need six different colors for various cells so I tweaked a code I copied from a website. I'm not a programmer. What is a UDF? How could I use that in this instance?
 
Upvote 0
A UDF is a user-defined function. It's not relevant to your issue because UDFs are specifically prevented from doing anything except returning a value to the cell in which they appear (just like native Excel functions). I mentioned them only because they are examples of VBA that doesn't kill Undo.

I expect you have this code running in response to a change event. Change it so you run it only as needed, e.g., from a button. It will still kill Undo, but only when you run it.

Or apply the conditional formatting statically beforehand. If you're using Excel 2007+, you can have as many conditions as you like.
 
Upvote 0
I am running in response to a change event. I need the colors to update as I enter the information so pressing a command button, especially since it will turn everything off as soon as it runs, is probably not going to be a great solution. Thanks for your help though. I really appreciate your time.
 
Upvote 0

Forum statistics

Threads
1,223,968
Messages
6,175,677
Members
452,666
Latest member
AllexDee

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