If Not Intersect(Target, Range("A1")) Is Nothing Then Select Case Target.Value
Case 2
Call FirstMacro
Case 4
Call SecondMacro
End Select
End If
End Sub
That code, as it stands, is not appropriate for a macro run from a button. I can only guess what you actually want. Perhaps:Conditions that have to be met:
Code:If Not Intersect(Target, Range("A1")) Is Nothing Then Select Case Target.Value Case 2 Call FirstMacro Case 4 Call SecondMacro End Select End If End Sub
So as I said when I click on button then above code should be run, depending of value in A1
Private Sub Button1_Click()
If ActiveCell.Address = "$A$1" Then
Select Case ActiveCell.Value
Case 2
Call FirstMacro
Case 4
Call SecondMacro
Case Else
End Select
End If
End Sub