View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default How to start a macro with a if statement

Right click on your worksheet tab, select view code and paste this code into
the code window

Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Address = "$A$1" And .Value = "foo" Then Call macro1
End With
End Sub


"Philippe_seattle" wrote:

Hello there,

Do you know if it is possible to start a macro from an if statement? For
examle, if A1=foo, run macro1.

I am trying to hide a few rows when a given information is entered