message box if no cells in range > 0

ThomasOES

Board Regular
Joined
Aug 29, 2017
Messages
174
Hello
I need vba code to check a range of cells for value greater than zero.
Ive set the range = colval
If there is no value in the range greater than zero I want a message box "No Value > 0"

Thanks for any help
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Maybe:
Code:
If Application.Countif(colval,">0")>0 then MsgBox "No value > 0"
 
Upvote 0
Did you write this correctly? Shouldn't the second greater than symbol be an equal sign instead?
Yikes!!! You are correct. The OP said: "If there is no value in the range greater than zero I want a message box "No Value > 0""
Guess I missed the bold no and focused on the message :eeek:. Thanks for the catch.
 
Upvote 0
Yikes!!! You are correct. The OP said: "If there is no value in the range greater than zero I want a message box "No Value > 0""
Guess I missed the bold no and focused on the message :eeek:. Thanks for the catch.

Thanks guys. Code works perfect now.
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,190
Members
452,616
Latest member
intern444

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