![]() |
Looping Question
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!!!! |
Looping Question
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 "MWS" wrote in message ... 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!!!! |
Looping Question
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 On Thu, 11 Nov 2004 12:24:01 -0800, MWS wrote: 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!!!! |
Looping Question
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!! "Myrna Larson" wrote: 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 On Thu, 11 Nov 2004 12:24:01 -0800, MWS wrote: 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!!!! |
All times are GMT +1. The time now is 09:56 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com