ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Execute Macro (https://www.excelbanter.com/excel-discussion-misc-queries/23181-execute-macro.html)

Yves

Execute Macro
 
Hello,
Is there a way to execute a macro in a formula ??
For example a need to execute a macro if the value in a cell is out of
range.
Many thanks for your help
Yves




JulieD

Hi

not directly, you can however, put worksheet change code against the sheet
to read the result of the formula and run appropriate code, e.g.
------
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$A$1" And Target.Value < 4 Then
Application.EnableEvents = False
Call Macro1
Application.EnableEvents = True
End If

End Sub

-------

if you'ld like help implementing something along these lines, please post
back with additional information

--
Cheers
JulieD
check out www.hcts.net.au/tipsandtricks.htm
....well i'm working on it anyway
"Yves" wrote in message
...
Hello,
Is there a way to execute a macro in a formula ??
For example a need to execute a macro if the value in a cell is out of
range.
Many thanks for your help
Yves






Yves

Hi,
Many thanks for your answer, it works very well
Regards.
Yves


"JulieD" a écrit dans le message de news:
...
Hi

not directly, you can however, put worksheet change code against the sheet
to read the result of the formula and run appropriate code, e.g.
------
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$A$1" And Target.Value < 4 Then
Application.EnableEvents = False
Call Macro1
Application.EnableEvents = True
End If

End Sub

-------

if you'ld like help implementing something along these lines, please post
back with additional information

--
Cheers
JulieD
check out www.hcts.net.au/tipsandtricks.htm
...well i'm working on it anyway
"Yves" wrote in message
...
Hello,
Is there a way to execute a macro in a formula ??
For example a need to execute a macro if the value in a cell is out of
range.
Many thanks for your help
Yves









JulieD

you're welcome and thanks for the feedback


"Yves" wrote in message
...
Hi,
Many thanks for your answer, it works very well
Regards.
Yves


"JulieD" a écrit dans le message de news:
...
Hi

not directly, you can however, put worksheet change code against the
sheet
to read the result of the formula and run appropriate code, e.g.
------
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$A$1" And Target.Value < 4 Then
Application.EnableEvents = False
Call Macro1
Application.EnableEvents = True
End If

End Sub

-------

if you'ld like help implementing something along these lines, please post
back with additional information

--
Cheers
JulieD
check out www.hcts.net.au/tipsandtricks.htm
...well i'm working on it anyway
"Yves" wrote in message
...
Hello,
Is there a way to execute a macro in a formula ??
For example a need to execute a macro if the value in a cell is out of
range.
Many thanks for your help
Yves












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

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