Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to start a macro with a if statement

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
  #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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
If Statement - no idea where to start! Mattymoo New Users to Excel 4 May 22nd 08 12:51 AM
Sub Macro vrs Function Macro Auto Start Pat Excel Discussion (Misc queries) 7 June 6th 07 09:53 PM
Macro Start zephyr Excel Discussion (Misc queries) 0 November 13th 06 05:01 PM
Start VBA with a macro? [email protected] Excel Programming 1 August 30th 04 05:11 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 07:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"