No, in general, formulas can only return values to their calling cells.
However, you can use an event macro that will check your cell each time
the sheet is calculated, say, and run the macro if the value of the cell
is 1. Put this in your worksheet code module (right-click the worksheet
tab and choose View Code):
Private Sub Worksheet_Calculate()
If Range("A1").Value = 1 Then MyMacro
End Sub
By IF statement I assume you mean the IF worksheet function; and not an IF
statement within the macro itself.
Probably not as a worksheet function cannot change another cell.
However, you could set up your macro as an event-triggered macro, and within
the macro test to see if the cell equals 1.
--ron
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.