Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Macro to delete blank rows

I have the following, but I need it to be more generic.

Sub Macro5()

Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="="
Rows("8:8").Select <---- I want this to be the first
blank row not row 8.
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp
Selection.AutoFilter Field:=1
End Sub


Thanks in advance,
Barb Reinhardt
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Macro to delete blank rows

There might be quicker ways to do it.

on error resume next
Range("A9:A65536").Cells.SpecialCells(xlCellTypeBl anks).EntireRow.Delete
on error goto 0

Change the range to what you want.

This will only delete really empty cells--not formulas that evaluate to "".

(so there is a difference)

Barb Reinhardt wrote:

I have the following, but I need it to be more generic.

Sub Macro5()

Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="="
Rows("8:8").Select <---- I want this to be the first
blank row not row 8.
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp
Selection.AutoFilter Field:=1
End Sub

Thanks in advance,
Barb Reinhardt


--

Dave Peterson
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
Delete blank rows Macro Richard Excel Discussion (Misc queries) 3 November 4th 05 08:02 AM
Using a macro to delete all blank rows Shirley Munro[_5_] Excel Programming 4 September 18th 05 09:05 AM
Delete blank rows in Excel with macro Pele[_2_] Excel Programming 6 November 3rd 04 06:53 PM
Macro to delete blank rows Jim Excel Programming 4 October 5th 04 04:08 PM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM


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