There are times when it might be nice to run a macro from a cell function. Something like : if a cell has a certain value, a macro will run:
You can not initiate a macro from a worksheet cell function. However, you can use the worksheet's Change event to do something like this:
Private Sub Worksheet_Change(ByVal Target As Excel.Range) If Not Application.Intersect(Target, Range("A1")) Is Nothing Then If Target.Value > 10 Then MsgBox "Put your macro code here in place of the MsgBox line" End If End If End Sub
When A1 is changed to a value greater than 10, the macro code will run.
To get to the Worksheet Event code, right-click the sheet tab and choose View Code.