View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default Running a macro from a conditional formula

hi,
not even close. formulas return values, they cannot perform actions like
call a macro. (also copy, paste, move, change color, phone home, ect)
but you can write a macro to do this. put it in the worksheet change event.
it might look something like this.

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

If Range("B5").Value = "Y" Then
Call Macro1
Else
If Range("B5").Value = "N" Then
call macro2
End If
End If
End Sub

hope this gives you ideas.
good luck
regards
FSt1

"Jim" wrote:

I'd like to run one of two different macros I have created based on a Yes or
No answer in a cell. I've tryed the following formula:

=IF(K16="No", Macro "Closed", Macro "Not_Closed)

I was just guessing at the command to run a macro from a cell, but was not
correct.

Any help?

Thanks

JIM