How do i get this macro not to run if target is empty or 0

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
2,350
Hi Everyone,

I have this macro that works great but I need it not t run if the cell I secect is zero or empty.
how can I do this/

p.s. if my code can be improved feel free to go ahead and change it :)
(Columns E & F are merged per row so E88:F88 etc.)
Thanks

Tony

Code:
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]Private Sub Worksheet_SelectionChange(ByVal Target As Range)[/FONT]
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]If Selection.Count = 2 Then
If Not Intersect(Target, Range("$E$88:$F$91")) Is Nothing Then
If Range("$E$93") = 1 Then
Call Yes_No_Message_Goals_4
End If
End If
End If[/FONT]
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]End Sub[/FONT]
 

FormR

MrExcel MVP
Joined
Aug 18, 2011
Messages
6,151
Office Version
365
Platform
Windows
How about this small addition..


Rich (BB code):
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Selection.Count = 2 Then
    If Not Intersect(Target, Range("$E$88:$F$91")) Is Nothing Then
        If Target.Cells(1, 1).Value > 0 Then
            If Range("$E$93") = 1 Then
                Call Yes_No_Message_Goals_4
            End If
        End If
    End If
End If
End Sub
 

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
2,350
I am laughing my head off, I must have tried everything but this FormR, and it worked perfectly,

Thanks
for your help

Tony
 

Forum statistics

Threads
1,077,990
Messages
5,337,585
Members
399,156
Latest member
RaudMees

Some videos you may like

This Week's Hot Topics

Top