ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   how can I insert a macro into a boolean statement (https://www.excelbanter.com/excel-worksheet-functions/62201-how-can-i-insert-macro-into-boolean-statement.html)

Garrett

how can I insert a macro into a boolean statement
 
now can I call a macro from a boolean statement i.e. "=if(c4<c5,call
macro,c4)"?

Don Guillett

how can I insert a macro into a boolean statement
 
right click sheet tabview codeinsert this and enter =now() somewhere on
the sheet but be aware it will fire each time anything is calculated on the
sheet. You might prefer a worsheet_change event restricted to only cell c4

Private Sub Worksheet_Calculate()
Application.EnableEvents = False
If Range("c4") < Range("c5") Then MsgBox "HI"
Application.EnableEvents = True
End Sub

--
Don Guillett
SalesAid Software

"Garrett" wrote in message
...
now can I call a macro from a boolean statement i.e. "=if(c4<c5,call
macro,c4)"?





All times are GMT +1. The time now is 04:42 PM.

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