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 Deleting Blank Rows

Hello, Can some tell me the code to use to delete blank rows of an excel file?

I thought I could create a loop to start at the first row and proceed
through the file and deleting the blank rows, but am having difficulty 1)
systematically identifying and deleting the blank rows and 2) stopping the
loop at the end of the file.

Any Help Would Be Appreciated - Thank You
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Deleting Blank Rows

Dim rng as Range
set rng = Columns(1).specialCells(xlBlanks)
if not rng is nothing then
rng.entirerow.Delete
End if

This assumes that the data in the first column can be used to determine
which rows are blank. Also that you do not have more then 8192 separate
(non-contiguous) areas in the first column.

--
Regards,
Tom Ogilvy

"MWS" wrote in message
...
Hello, Can some tell me the code to use to delete blank rows of an excel

file?

I thought I could create a loop to start at the first row and proceed
through the file and deleting the blank rows, but am having difficulty 1)
systematically identifying and deleting the blank rows and 2) stopping the
loop at the end of the file.

Any Help Would Be Appreciated - Thank You



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default Deleting Blank Rows

MWS, here is one way,

Sub Delete_blank_rows()

'Will delete the whole row where there are blank cells in A1:A50

[A1:A50].SpecialCells(xlCellTypeBlanks).EntireRow.Delete

End Sub
--
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 2002 & 2003


"MWS" wrote in message
...
Hello, Can some tell me the code to use to delete blank rows of an excel
file?

I thought I could create a loop to start at the first row and proceed
through the file and deleting the blank rows, but am having difficulty 1)
systematically identifying and deleting the blank rows and 2) stopping the
loop at the end of the file.

Any Help Would Be Appreciated - Thank You



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
Need Help Deleting Blank Rows JCG Excel Worksheet Functions 3 February 22nd 10 04:53 PM
Deleting Blank Rows. GEM Excel Discussion (Misc queries) 3 April 15th 09 04:18 PM
Deleting blank rows Yvette Excel Worksheet Functions 3 June 9th 06 10:30 AM
Deleting blank rows Michael Chang Excel Programming 2 January 21st 05 02:47 AM
DELETING BLANK ROWS Robert Lowe Excel Programming 3 August 30th 04 10:04 PM


All times are GMT +1. The time now is 02:11 AM.

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"