+ Reply to Thread
Results 1 to 2 of 2

Macro to delete blank rows

  1. #1
    Barb Reinhardt
    Guest

    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. #2
    Dave Peterson
    Guest

    Re: Macro to delete blank rows

    There might be quicker ways to do it.

    on error resume next
    Range("A9:A65536").Cells.SpecialCells(xlCellTypeBlanks).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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1