Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default If statements and macros

Is it possible for an "if" statement to initiate a macro?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default If statements and macros


Hello Bmorganh,

in VBA code yes you can initate a macro using a If statement. Jus
substitute the name of your macro for MyMacro in the example. The macr
can be run at anytime in VBA simply by placing the macro's name, and an
arguments required in your code.

Example:
If condition = True Then
Call MyMacro
End If

Sincerely,
Leith Ros

--
Leith Ros
-----------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=56400

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default If statements and macros

Sure

If Range("A1").Value = 1 Then
Range("C1").Interior.ColorIndex = 3
Else
Range("C1").Interior.ColorIndex = 5
End If

(though you wouldn't need a macro for this)

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"bmorganh" wrote:
| Is it possible for an "if" statement to initiate a macro?


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 statements in macros Dan Wood Excel Discussion (Misc queries) 10 December 17th 09 02:48 PM
How can I use wildcards in IF statements and Macros AlanF Excel Discussion (Misc queries) 2 November 22nd 09 11:08 PM
How do i start Macros using IF statements? xXx Katie xXx Excel Discussion (Misc queries) 2 August 22nd 05 03:13 PM
Macros and if statements Rebecca Excel Programming 2 July 29th 04 04:04 AM
True / false statements in Macros RogerNZ Excel Programming 3 June 14th 04 03:13 AM


All times are GMT +1. The time now is 11:40 PM.

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

About Us

"It's about Microsoft Excel"