Execute Macro

  • Thread starter Thread starter Yves
  • Start date Start date
Y

Yves

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top