Does value exist in column?

In VBA I need to set a True or False value based on values in column E.
Is there a way to tell Excel to set ColumnDoesNotHaveZero = True?  If there are no zeros in that column.
Column E can have any value in it, except a "0", if there is a zero? set ColumnDoesNotHaveZero = False
Please advise and thanks.
Who is Participating?
KimputerConnect With a Mentor Commented:
Then simple VBA code will do?

Sub test()

Dim ColumnDoesNotHaveZero As Boolean

ColumnDoesNotHaveZero = True

Count = ActiveSheet.UsedRange.Rows.Count

For i = 1 To Count Step 1
    If ActiveSheet.Cells(i, 5).Value = 0 Then
        ColumnDoesNotHaveZero = False
    End If

MsgBox ColumnDoesNotHaveZero

End Sub

Open in new window

I'd say, set Worksheet_Change event, and inside, have it check only if column E was edited, enumerate every value of the column E, based on own limit, or UsedRange, and then set the ColumnDoesNotHaveZero value).
RWayneHAuthor Commented:
Worksheet is a static export from an extract.  Just need to check for it.
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Rob HensonConnect With a Mentor Finance AnalystCommented:
Set Flag based on WorksheetFunction.COUNTIF($E:$E,0)

If Count is 0 - Flag = True; If Count >0 - Flag = False

Rob H
RWayneHAuthor Commented:
These lines show red in the editor.
RWayneHAuthor Commented:
Thank for the help.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.