Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Richard
 
Posts: n/a
Default Delete blank rows Macro

Using MS Excel 2000.
Help creating a macro please.

I need to search the range A1:A10000 and if the cell is blank I want to
delete the entire row.

Thanks in advance.
--
Richard
  #2   Report Post  
Jack Sheet
 
Posts: n/a
Default Delete blank rows Macro


"Richard" wrote in message
...
Using MS Excel 2000.
Help creating a macro please.

I need to search the range A1:A10000 and if the cell is blank I want to
delete the entire row.

Thanks in advance.
--
Richard


Something like

Sub DeleteRowsIfBlank()
Dim lrow as Long
For lRow = 10000 to 1 step -1
If IsEmpty(Range("A"&lrow)) then Range("A"&lrow).Entirerow.Delete
Next lRow
End Sub

Probably not the most efficient code but should work I think. You may want
to specify the worksheet object in which Range resides, for safety.


  #3   Report Post  
Nick Hodge
 
Posts: n/a
Default Delete blank rows Macro

Richard

Does it have to be a macro?

Sort the data by columnA and then the blanks will be at the bottom, then
select these rows and delete.

If you need a macro post back and we'll go that route

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
HIS


"Richard" wrote in message
...
Using MS Excel 2000.
Help creating a macro please.

I need to search the range A1:A10000 and if the cell is blank I want to
delete the entire row.

Thanks in advance.
--
Richard



  #4   Report Post  
Nick Hodge
 
Posts: n/a
Default Delete blank rows Macro

Additionally, if you want the data back as it was pre-sort then run an index
down a blank column by entering a 1 in the top cell, 2 in the next, then
select both and double click the 'fill handle'. (Square in bottom right of
second cell)

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
HIS


"Richard" wrote in message
...
Using MS Excel 2000.
Help creating a macro please.

I need to search the range A1:A10000 and if the cell is blank I want to
delete the entire row.

Thanks in advance.
--
Richard



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
select and delete all blank rows Bill from UniqueAuction.com Excel Discussion (Misc queries) 1 October 11th 05 09:06 PM
Delete Rows where cells does not meet criteria Danny Excel Worksheet Functions 1 September 12th 05 05:08 PM
Macro to delete NoviceIan New Users to Excel 2 September 1st 05 01:03 PM
Pivot Tables & not printing blank rows (revisited) [email protected] Excel Discussion (Misc queries) 1 August 4th 05 07:42 AM
How can we delete rows permanently from excel sheet Nehal Shah Excel Discussion (Misc queries) 1 August 1st 05 01:58 PM


All times are GMT +1. The time now is 10:40 AM.

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

About Us

"It's about Microsoft Excel"