JackDanIce
Well-known Member
- Joined
- Feb 3, 2010
- Messages
- 9,922
- Office Version
- 365
- Platform
- Windows
Hi,
I have the following code attached to a command button, which is found inside a worksheet (rather than in a module):
I also have existing macros within modules in this same workbook. If I want to call the above from an existing macro how can I do this? Simply typing:
or
Doesn't work, error message is: Compile error: Variable not defined; I have an understanding of what this means but I don't know how to resolve this issue as I've not come across it before.
Thanks in advance for any help,
Jack
I have the following code attached to a command button, which is found inside a worksheet (rather than in a module):
Code:
Private Sub ToggleCalc_Click()
With Application
If .Calculation = xlCalculationAutomatic Then
.Calculation = xlCalculationManual
With ToggleCalc
.BackColor = RGB(240, 128, 128)
.Caption = "Calc is: Manual"
End With
Else
.Calculation = xlCalculationAutomatic
With ToggleCalc
.BackColor = RGB(176, 224, 230)
.Caption = "Calc is: Automatic"
End With
End If
End With
End Sub
Code:
ToggleCalc_Click
Code:
Run ToggleCalc_Click
Thanks in advance for any help,
Jack