ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   delete row if 2 cells are empty (https://www.excelbanter.com/excel-discussion-misc-queries/248932-delete-row-if-2-cells-empty.html)

Wanna Learn

delete row if 2 cells are empty
 
Hello I get a daily report and I have to delete the entire row if cell AA
and Cell AB are empty. staring from row 4 till the end. I have been doing
this manually but is there a VBA code that would make this faster. thanks
in advance

Don Guillett

delete row if 2 cells are empty
 
Unless aa a/o bb populated with a space bar this should do it.

Sub delrowsifaaempty()
lr = Cells.find(What:="*", After:=[A1], _
SearchDirection:=xlPrevious).Row
For i = lr To 4 Step -1
If Cells(i, "aa") = "" And Cells(i, "ab") = "" Then Rows(i).Delete
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Wanna Learn" wrote in message
...
Hello I get a daily report and I have to delete the entire row if cell AA
and Cell AB are empty. staring from row 4 till the end. I have been
doing
this manually but is there a VBA code that would make this faster.
thanks
in advance




All times are GMT +1. The time now is 06:23 AM.

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