Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
MWS MWS is offline
external usenet poster
 
Posts: 53
Default 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!!!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default 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!!!!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default 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!!!!


  #4   Report Post  
Posted to microsoft.public.excel.programming
MWS MWS is offline
external usenet poster
 
Posts: 53
Default 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!!!!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Looping question Jase Excel Discussion (Misc queries) 2 March 19th 08 02:03 PM
Looping Question MWS Excel Discussion (Misc queries) 1 June 5th 06 07:23 PM
looping question luke New Users to Excel 4 June 3rd 05 01:19 PM
Looping Question (I think?) MWS Excel Programming 2 October 27th 04 02:09 PM
Looping Question MWS Excel Programming 0 October 27th 04 01:49 PM


All times are GMT +1. The time now is 08:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"