Count of rows with nulls

T

tbmarlie

I've created code previously where I deleted rows based on certain
criteria being found in that row. In doing so I had the code below
that did a count of rows in column a. This code assumed that there
were no blank cells in column a. How would I change this code if I
don't have any columns in my data where there are no blank cell?.

For k = Cells(Rows.Count, "a").End(xlUp).Row To 1 Step -1
If Cells(k, "a") = "GMEIS" Then Rows(k).EntireRow.Delete
Next k

Thanks
 
G

Guest

Hi tbmarlie,

I'm not entirely sure what you are trying to do. You say "How would I change
this code if I don't have any columns in my data where there are no blank
cell?" So you are saying what if you DO have columns WITH blank cells. As far
as I can see your current code will delete rows that contain "GMEIS" in
column A, and should work if there are blank cells in column.

If you could help me to understand better what you are trying to achieve I
will do my best to help.

Sean.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top