View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
BK523 BK523 is offline
external usenet poster
 
Posts: 7
Default Run a macro from within a function

Thabnk you for your reply. It looks like this is a good approach & I will
take some time to develop it.



"Gord Dibben" wrote:

Formulas cannot run macros.

You could use event code to run a macro when C3 is changed to yes.

Option Compare Text
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo stoppit
Application.EnableEvents = False
If Target.Address = "$C$3" And Target.Value = "yes" Then
Call macroname
End If
stoppit:
Application.EnableEvents = True
End Sub


Gord Dibben MS Excel MVP

On Tue, 13 Jan 2009 11:38:06 -0800, 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?