Looping Question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can someone direct me how to create a loop which will start at the top; or
botton, of a series of data and blank rows, and loop through each row and
delete the rows which are completely empty?

Any and all help would be appreciated. Thanks in advance!!!!
 
MWS, How about something like this

[A1:A50].SpecialCells(xlCellTypeBlanks).EntireRow.Delete
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 2003
 
Assuming you want to use a loop, the following will delete a row if there are
no entries in columns A:K. It doesn't look for entries beyond column K.

Set Rng = Range("A10:K200")
For R = Rng.Rows.Count to 1 Step - 1
If Application.CountA(Rng.Rows(R)) Then
Rng.Rows(R).EntireRow.Delete
End If
Next R

If you want to check the entire row (all 256 columns)

Set Rng = Range("A10:IV200")
For R = Rng.Rows.Count to 1 Step - 1
If Application.CountA(Rng.Rows(R)) Then
Rng.Rows(R).EntireRow.Delete
End If
Next R
 
Myrna, Thank you for the response. Since you mentioned "assuming you want to
use a loop,....", do you think there is a more efficient way of deleting the
rows without using a loop? I'm just curious and also willing to try new ideas.

Thanks Again!!
 

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

Back
Top