ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run Macro From If Statement (https://www.excelbanter.com/excel-programming/330893-run-macro-if-statement.html)

bhalooneel

Run Macro From If Statement
 

Is there a command to run a macro as the condition for TRUE in an I
statement

--
bhaloonee
-----------------------------------------------------------------------
bhalooneel's Profile: http://www.excelforum.com/member.php...fo&userid=2402
View this thread: http://www.excelforum.com/showthread.php?threadid=37638


jose luis

Run Macro From If Statement
 

Could you tell where is the IF statment located? in a Cell or in
Macro? it depends...

bhalooneel Wrote:
Is there a command to run a macro as the condition for TRUE in an I
statement


--
jose lui
-----------------------------------------------------------------------
jose luis's Profile: http://www.excelforum.com/member.php...fo&userid=1331
View this thread: http://www.excelforum.com/showthread.php?threadid=37638


bhalooneel[_2_]

Run Macro From If Statement
 

It's in the cell.


--
bhalooneel
------------------------------------------------------------------------
bhalooneel's Profile: http://www.excelforum.com/member.php...o&userid=24023
View this thread: http://www.excelforum.com/showthread...hreadid=376381


jose luis

Run Macro From If Statement
 

bhalooneel Wrote:
It's in the cell.


1. Put your IF in the cell
2. Label the cell (lets say SwCell)
3. put your macro in the Worksheet.Calculate. Something like



Code:
--------------------
If Range("Condition onSwCell") Then
Your Code
Else
your code
End If
--------------------


4. Pull the result of the Cell to your Macro with Range("Condition
onSwCell")


Your Macro will run every time the worksheet is calculated, if it in
automatic calculation, always will be testting your condition and doing
your code.


Hope this helps

Regards

Jose Luis


--
jose luis
------------------------------------------------------------------------
jose luis's Profile: http://www.excelforum.com/member.php...o&userid=13312
View this thread: http://www.excelforum.com/showthread...hreadid=376381



All times are GMT +1. The time now is 03:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com