delete row if 2 cells are empty

W

Wanna Learn

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
 
D

Don Guillett

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
 

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