I recently was befuddled with some VBA code and had to sort things out.
The statement to change the application's calculation mode is:
Application.Calculation = [something]
I've always used (well, for 20 years or more?) the "somethings" as:
= xlCalculationAutomatic
= xlCalculationManual
= xlCalculationSemiautomatic
Call these the verbose formats. I now realize there are the concise formats:
= xlAutomatic
= xlManual
= xlSemiautomatic
I've even found that I used the concise formats myself in some very old Excel files. I guess I forgot about them after using my reference books that use the verbose format.
I have tested and they do the same things and are equivalent. When I recorded a macro while assigning the calculation mode Excel VBA used the concise format. When I assign the calculation mode in code using the verbose format then have a msgbox report on the calculation mode it also uses the concise format...thus I have to assume the concise and verbose are equivalent.
I found on-line references use either but do not talk to the fact that there are both and they are equivalent. Here are two references from random sites:
uses the concise format
O'Reilly uses the verbose format
Anyway, I suppose this is more of a PSA rather than a question or a rant. It's something that I was surprised to see and realize after so many years of using VBA.
Excel. A great and wonderful tool! Sometimes mysterious and frustrating.
The statement to change the application's calculation mode is:
Application.Calculation = [something]
I've always used (well, for 20 years or more?) the "somethings" as:
= xlCalculationAutomatic
= xlCalculationManual
= xlCalculationSemiautomatic
Call these the verbose formats. I now realize there are the concise formats:
= xlAutomatic
= xlManual
= xlSemiautomatic
I've even found that I used the concise formats myself in some very old Excel files. I guess I forgot about them after using my reference books that use the verbose format.
I have tested and they do the same things and are equivalent. When I recorded a macro while assigning the calculation mode Excel VBA used the concise format. When I assign the calculation mode in code using the verbose format then have a msgbox report on the calculation mode it also uses the concise format...thus I have to assume the concise and verbose are equivalent.
I found on-line references use either but do not talk to the fact that there are both and they are equivalent. Here are two references from random sites:
uses the concise format
O'Reilly uses the verbose format
Anyway, I suppose this is more of a PSA rather than a question or a rant. It's something that I was surprised to see and realize after so many years of using VBA.
Excel. A great and wonderful tool! Sometimes mysterious and frustrating.