A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

delete row if 2 cells are empty



 
 
Thread Tools Display Modes
  #1  
Old November 19th, 2009, 09:46 PM posted to microsoft.public.excel.misc
Wanna Learn
external usenet poster
 
Posts: 340
Default 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
  #2  
Old November 19th, 2009, 10:20 PM posted to microsoft.public.excel.misc
Don Guillett
external usenet poster
 
Posts: 6,167
Default 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


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:06 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.