For 25 years I have written hundreds of subroutines that did something like this.
Application.calculation = false
Application.calculation = true
That approach always reset the specific setting to its default value which is not what I really wanted
Instead I wanted the following approach, but I never knew how to do it generically.
Today, I finally figured out a fairly easy solution which I have shown in the attached .xlsm file. The above code becomes.
My Push routine is very simple (see the .xlsm file for the actual subroutines and more details).
So I am asking my fellow experts for advice and suggestions.
ee aug22 Push and Pop settings.xlsm
- Have any of you ever seen a similar or better solution?
- Do you think this idea is worthy of an experts-exhange article?
- Do you think you would use this code yourself?
- Currently, I support aEnableEvents, aScreenUpdating, aDisplayAlerts, aCalculation, and aCustom
what other settings should I support?
- My .xlsm file currently supports pushing and popping of user defined variables. I wonder if that is a bad idea?
- I currently have very little error checking. I feel that it is the developers job to make sure the Push and Pop calls match properly..
- Any other improvements you can think of?