I have a code to deactivate a command button on sheet 2 when cell A1 is being used.
I have to click on sheet 2 then back to sheet 1 then back to sheet 2 to disable/enable command button (to activate it)
Is there a way to update the commandbutton instantly? (execute the program)
I have to click on sheet 2 then back to sheet 1 then back to sheet 2 to disable/enable command button (to activate it)
Is there a way to update the commandbutton instantly? (execute the program)
VBA Code:
Private Sub Worksheet_Activate()
Dim CV As Boolean
If Worksheets("Sheet1").Range("A1").Value = "" Then CV = False
If CV = False Then Worksheets("Sheet2").CommandButton1.Enabled = False
If Worksheets("Sheet1").Range("A1").Value > 0 Then CV = True
If CV = True Then Worksheets("Sheet2").CommandButton1.Enabled = True
End sub