PDA

View Full Version : Run macro IF



willemeulen
01-15-2010, 06:29 AM
How do I run a macro IF ....


Cell T67 is TRUE, and repeat when data is updated?

:help

garydp
01-15-2010, 06:46 AM
you can try


Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("T67")) Is Nothing Then
Exit Sub
Else
'Your Macro Name Here
End If
End Sub

p45cal
01-15-2010, 12:00 PM
you can try


Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("T67")) Is Nothing Then
Exit Sub
Else
'Your Macro Name Here
End If
End Sub

If I'm not mistaken, doesn't that miss out testing for true?
Perhaps this?
Private Sub Worksheet_Change(ByVal Target As Range)
If Not (Intersect(Target, Range("T67")) Is Nothing) And Range("T67") = True Then YourMacroName
End Sub

willemeulen
01-16-2010, 02:54 AM
will try on monday. And second post was right. But in my case I want to check the true statement first, if not true exit otherwise run macro.

When other cell changes run macro again.

The cell containing true actually checks if all data needed for the required calculation is completed by user, if not it will show false.
The second cell i will do a summ of all input data, when this sum changes the macro has to run agian.

t

D_Rennie
01-16-2010, 03:04 AM
hello

you will need to use the aftercalculation event