how can i use an if statement to run a macro?
Insert this code into your sheet and you should be good to go.
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" And Target.Value = 1 Then
Call MyMacro 'Insert the name of your macro here
End If
End Sub
To add this to a sheet right click on the sheet tab - select view code
-paste
HTH
"Jack" wrote:
if ( a1 = 1, run macro, " ")
what code do i need to use to do this?
|