Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Can you call a macro as in an IF statement



As the subject implies, I want to know if I can call a macro as a result
of true logic in an IF statement. If not, how do you go about calling a
macro as a result of conditional statements?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Can you call a macro as in an IF statement

A macro can only be called with a macro
sub gg()
if range("a1")=1 then call mymacro
end sub

--
Don Guillett
SalesAid Software

"kls" wrote in message
...


As the subject implies, I want to know if I can call a macro as a result
of true logic in an IF statement. If not, how do you go about calling a
macro as a result of conditional statements?

*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Can you call a macro as in an IF statement

in VBA

If condition then
mymacro
End if

in A worksheet cell, create a userdefined function

=if(condition,Trigger(),"")

Public Function Trigger()
Trigger = "ABCD"
End Function

however, Trigger can only return a value. It can not change other aspects of
the worksheet.

If you need to do things like that, use the calculate or the change event.

--
regards,
tom Ogilvy

"kls" wrote in message
...


As the subject implies, I want to know if I can call a macro as a result
of true logic in an IF statement. If not, how do you go about calling a
macro as a result of conditional statements?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



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
Call Macro jswalsh33 Excel Discussion (Misc queries) 2 February 21st 10 10:38 AM
How can run a macro ( call a macro) on selection of any filtercriteria? [email protected] Excel Worksheet Functions 7 February 20th 09 12:34 AM
Call an Access macro from an Excel macro Jason W Excel Discussion (Misc queries) 1 May 1st 08 08:33 PM
macro call Steve Excel Discussion (Misc queries) 12 August 25th 06 04:27 AM
How to call a macro in an XLA add-in Peter Laman Excel Discussion (Misc queries) 1 March 10th 05 05:40 PM


All times are GMT +1. The time now is 09:25 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"