View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Run a macro from within a function

Hi,

Yes you probably can but no you can't simply call a macro with an if
statement. Some cell must change to make C3 switch between "Yes" & "no". so
you can use the worksheet change event to fire your macro.

Right click your sheet tab, view code and paste this in

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("C3").Value < "Yes" Then Exit Sub
'do things
End Sub

Mike

"BK523" wrote:

I would like to launch a macro from within an "IF" statement.
Example: Cell C3 is a "yes / no" type cell. Cell C4 would evaluate the
contents of C3 and launch a macro if C3="Yes"

Can this be done?