+ Reply to Thread
Results 1 to 3 of 3

Deleting Blank Rows

  1. #1
    MWS
    Guest

    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. #2
    Tom Ogilvy
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    > 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. #3
    Paul B
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    > 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 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