Embeddding a macro in Logical IF stmt

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I am trying to embed a macro in a logical IF statement in the true result. Is this even possible, and if so how

Thanks for your help!
 
Ron,

I guess that you mean a worksheet IF. You can, but the things that macro can
do are limited. It would need to be a function, and it can return a value,
but it cannot change any properties of the cell/worksheet.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Ron said:
Hi,

I am trying to embed a macro in a logical IF statement in the true result.
Is this even possible, and if so how?
 
Hi ron

You posted private that you use it in a formula
Try to use the calculate event in the Sheet module

This example will run the macro "YourMacroName" If the formula cell B1 display a value
higher then 10

Private Sub Worksheet_Calculate()
If Me.Range("b1").Value > 10 Then
YourMacroName
Else
'do nothing
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