Forum Discussion
egurs
Dec 16, 2021Copper Contributor
Excel Undo Function Not Working Properly in Workbook with UDF
I am having a problem with Excel's undo function in a macro-enabled workbook that contains a user-defined function. If I take a bunch of random actions and then click the down-arrow next to the undo...
Riny_van_Eekelen
Dec 16, 2021Platinum Contributor
egurs This is a well documented issue. Google for instance for "undo stack excel cleared after running VBA" and you'll find many resources discussing it, like the one in the link below.
- egursDec 16, 2021Copper Contributor
Riny_van_EekelenThanks for the lead. Looks like the issue was the "Application.Volatile True" line in the VBA code of the UDF. Took that out and undo is working again, with no apparent impact on the functionality of the UDF.
- PeterBartholomew1Feb 23, 2022Silver ContributorPresumably that means you are OK up to the point at which you force the function to evaluate.
There are techniques like running the code from a validation condition or a hyperlink where the normal restrictions of UDFs a bypassed but that is not my normal territory. - Michelle2006Feb 23, 2022Copper ContributorIf only I knew how to do this 😞