Excel VBA Undo Issues

smitpau

Board Regular
Joined
Apr 2, 2020
Messages
167
Office Version
  1. 365
Platform
  1. Windows
Hi,

Appreciate the title is quite broad so I'll be specific.

I'm using the code from the website below, it basically creates a "User Defined Function" (UDF) in Excel which can be used to change chart axis values.

It's quite helpful but now the Undo feature stops working.

Is there some sort of workaround such as having a Macro Button to trigger when to start the code as it doesn't need to be constantly calculating in the background as hopefully then Undo will work like normal.

If anyone has any ideas it would be much appreciated.

Thanks for reading!

Link:
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
I suspect something else is occurring at your location. The workbook "undo" function works as expected here.
 
Upvote 0
Again: " The workbook "undo" function works as expected here. "

The Menu Bar "Undo" arrows function well here.

I inserted a short macro :

Sub Undu()
Application.Undo
End sub

And found the macro will perform an UNDO action once. Attempting to run the macro more than once creates an error.
 
Upvote 0
I'd start by removing the line that makes the UDF volatile. If you're passing the necessary Min/Max values to it as arguments, you shouldn't need it to be volatile.
 
Upvote 0
Thanks for the comments, I'll check out the how to undo a macro link.

RoryA maybe a basic question but how do I check the line(s) that are volatile in the VBA, as the Min/Max values are cell references so believe this may solve it.
 
Upvote 0
Logit initially I could undo once at a time (similar to you) but after more of these UDF's that have been added the undo functionality has stopped working at all.
 
Upvote 0
Yes, I was also able to use the built-in Undo once on a very simple Macro (which surprised me), but unable to after that, even if I closed Excel and re-opened.
 
Upvote 0
Just remove the line that starts with Application.Volatile in the UDF, then re-enter one of the UDFs.
 
Upvote 0
Sorry RoryA don't quite follow, where is the line Application.Volatile as I can't seem to find it.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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