• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 43
  • Last Modified:

Looking for blank values in a column, without using Autofilter

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

0
RWayneH
Asked:
RWayneH
  • 2
  • 2
2 Solutions
 
Saurabh Singh TeotiaCommented:
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...
0
 
RWayneHAuthor 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
0
 
Saurabh Singh TeotiaCommented:
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...
0
 
RWayneHAuthor Commented:
Thanks for the help.
0
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.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now