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

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,210
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
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]
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
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
 
Upvote 0
I am laughing my head off, I must have tried everything but this FormR, and it worked perfectly,

Thanks
for your help

Tony
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,157
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top