ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Count of rows with nulls (https://www.excelbanter.com/excel-programming/399794-count-rows-nulls.html)

tbmarlie

Count of rows with nulls
 
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


SeanC UK[_3_]

Count of rows with nulls
 
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.


--
(please remember to click yes if replies you receive are helpful to you)


"tbmarlie" wrote:

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




All times are GMT +1. The time now is 05:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com