We help IT Professionals succeed at work.

Looking for blank values in a column, without using Autofilter

RWayneH
RWayneH asked
on
This code used to look at AC and tell me if there were any zero's in it.  How would use that same code to tell me if there are any blanks in it instead of zero's?  There is always data in column A.  Issue is that they are all blank.  If there are blanks I need to Exit For... so I need PurReqCreated to = False

How would I rewrite this to first select the proper lngLastRow based on data existing in column A, and second is there a blank in that range in column AC?    then   Set PurReqCreated = False

PurReqCreated = True  'Set as True to start.
'Define column AC and what is in it.
    lngLastRow = Range("AC" & Rows.Count).End(xlUp).Row
    PurReqCreated = Evaluate("NOT(-SUM(--(AC1:AC" & lngLastRow & "=0)))")
    'Evaluates if true or false. No zero's = True, Yes zero's False
'        If PurReqCreated = False Then Exit For
'   

Open in new window

Comment
Watch Question

Top Expert 2015
Commented:
You can use this to do what you are looking for...

PurReqCreated = True  'Set as True to start.
'Define column AC and what is in it.
    lngLastRow = Range("AC" & Rows.Count).End(xlUp).Row
    PurReqCreated = Evaluate("NOT(-SUM(--(AC1:AC" & lngLastRow & "="""")))")
    'Evaluates if true or false. No zero's = True, Yes zero's False
'        If PurReqCreated = False Then Exit For

Open in new window


Saurabh...

Author

Commented:
I am afraid that because the only thing in AC is a column header that it will not define lngLastRow correctly.  My example has 3 rows and a header.  Column A will always have a value in it.  Testing it as is now
Top Expert 2015
Commented:
Change this to A Column then...

 lngLastRow = Range("A" & Rows.Count).End(xlUp).Row

Open in new window


and then use this to do whatever you are looking for..

Saurabh...

Author

Commented:
Thanks for the help.