Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default delete row if a cell is blank

Hi All,

I would like to write a basic macro that will search a column and
delete a row if the cell is blank

A
1 Orange
2
3 Apple
4 Pear
5
6 Grape

For instance, I would like the macro to delete rows two and five in the
above example. The number of rows to search will vary, so maybe it
would be easier to start at the bottom of the worksheet and work up.
Also, there may be text in other columns, so the whole row won't
necessarily be blank.

Thanks,
Steve

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default delete row if a cell is blank

Nevermind, I think I was able to find the answer from Dave Ritchie.

Thanks!
Steve

Sub EliminateBlankColumnC()
On Error Resume Next ' In case there are no blanks
Columns("C:C").SpecialCells(xlCellTypeBlanks).Enti reRow.Delete
ActiveSheet.UsedRange 'Resets UsedRange for Excel 97
End Sub

Steve Mackay wrote:
Hi All,

I would like to write a basic macro that will search a column and
delete a row if the cell is blank

A
1 Orange
2
3 Apple
4 Pear
5
6 Grape

For instance, I would like the macro to delete rows two and five in the
above example. The number of rows to search will vary, so maybe it
would be easier to start at the bottom of the worksheet and work up.
Also, there may be text in other columns, so the whole row won't
necessarily be blank.

Thanks,
Steve


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
To delete rows when more than one cell is blank [email protected] Excel Worksheet Functions 4 September 27th 06 10:49 PM
Delete a row if blank cell mohd21uk via OfficeKB.com Excel Discussion (Misc queries) 1 May 4th 06 01:40 PM
Delete a row if blank cell mohd21uk via OfficeKB.com Excel Discussion (Misc queries) 1 May 4th 06 12:27 PM
Delete a row if blank cell mohd21uk via OfficeKB.com New Users to Excel 2 April 13th 06 04:39 PM
Delete row if cell in col b is blank claytorm Excel Discussion (Misc queries) 4 November 8th 05 07:30 PM


All times are GMT +1. The time now is 11:09 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"