Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xlCalculationManual versus xlManual 1

Status
Not open for further replies.

Deniall

Technical User
May 15, 2011
250
Australia
I run Excel 2010.[ ] I have just noticed that in some of the VBA code I have developed over the last ten years I have used
[ ][ ][ ][ ][ ]Application.Calculation = xlCalculationManual
while elsewhere I have used
[ ][ ][ ][ ][ ]Application.Calculation = xlManual
(with a corresponding alternation between xlCalculationAutomatic and xlAutomatic).

Both forms work fine, which is hardly surprising since the two reserved variables have the same value of -4135.

Does anyone on this forum know why Excel (2010) has two reserved variables here, rather than just the one?
Is it because Microsoft is/was transitioning from one to the other?
If so, which one is the "new" one?

My concern here is the longevity of my spreadsheets.[ ] If MS is/was transitioning, I would prefer to use the variable with a future rather than the one with a past.
 
If you look at enumerations in excel, there is one [tt]Constants[/tt] that contains a lot of different entries, and other starting with [tt]xl[/tt] and description, group specific constants and are esp. useful when the intellisense is on.

[tt]xlCalculation[/tt] belongs to [tt]Constants[/tt]. [tt]xlCalculationAutomatic[/tt] belongs to [tt]xlCalculation[/tt]. [tt]Application.Calculation[/tt] property is defined as [tt]xlCalculation[/tt] and after "=" vba intellisense suggests one of its members.

Both enumerations are visible, so probably both will be accessible in future. For me Application.Calculation = xlCalculationManual assignment is more secure, as it directly refers to Calculation property.

There are more similar constants. For instance, xlRight=-4152. The same value have xlHAlignRight, xlLabelPositionRight, xlLegendPositionRight and some others.

combo
 
Many thanks.[ ] Exactly the sort of information (and assurance) that I was hoping for as I sit here going through all my spreadsheets trying to ensure that all take pretty much the same approach to such things.[ ] (A chap's gotta do something when he's in his fourth Covid-induced lockdown.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top