Changing nonBoolean settings

Use a Select Case structure for non-Boolean settings. This example toggles the calculation mode between manual and automatic and displays a message indicating the current mode:

Sub ToggleCalcMode()

Select Case Application.Calculation Case xlManual

Application.Calculation = xlCalculationAutomatic MsgBox "Automatic Calculation Mode" Case xlAutomatic

Application.Calculation = xlCalculationManual MsgBox "Manual Calculation Mode" End Select End Sub

You can adapt this technique for changing other non-Boolean settings.

0 0

Post a comment