If function help required

  • Thread starter Thread starter DeViL_LaW
  • Start date Start date
D

DeViL_LaW

i need to create an if statement to be ab;le to run a macro when the
value is true. i want it the value of cell a1 = 2 then do a macro
=IF(A1=2,macro,"false") "i tried to do something but it gives the error
-#name?- this has a problem because it doesn't know which macro to
run.. i need the format of the if statement..
Hope i made it clear to what i want.

George
 
DeViL_LaW said:
i need to create an if statement to be ab;le to run a macro when the
value is true. i want it the value of cell a1 = 2 then do a macro
=IF(A1=2,macro,"false") "i tried to do something but it gives the error
-#name?- this has a problem because it doesn't know which macro to
run.. i need the format of the if statement..
Hope i made it clear to what i want.

George

You cannot run a macro from a formula. Running a macro is an event in time.
The result of a formula is a continuing state, not an event. If you put the
number 2 in A1, then A1=2 is true, not just at one instant, but for all time
(until you change the value). So, presumably you want to run the macro from
the event A2 BECOMING true, for which you will need a change event in VBA,
not a worksheet formula.
 
Back
Top