Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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!!!! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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!!!! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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!!!! |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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!!!! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Looping question | Excel Discussion (Misc queries) | |||
Looping Question | Excel Discussion (Misc queries) | |||
looping question | New Users to Excel | |||
Looping Question (I think?) | Excel Programming | |||
Looping Question | Excel Programming |