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

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
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 :eek:. 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 :eek:. Thanks for the catch.

Thanks guys. Code works perfect now.
 
Upvote 0

Forum statistics

Threads
1,214,661
Messages
6,120,792
Members
448,994
Latest member
rohitsomani

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