+ Reply to Thread
Results 1 to 4 of 4

Delete blank rows Macro

  1. #1
    Richard
    Guest

    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. #2
    Jack Sheet
    Guest

    Re: Delete blank rows Macro


    "Richard" <Richard@discussions.microsoft.com> wrote in message
    news:DD28F95E-58CF-4961-A3AD-E37FC68AE0F4@microsoft.com...
    > 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. #3
    Nick Hodge
    Guest

    Re: 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
    nick_hodgeTAKETHISOUT@zen.co.uk.ANDTHIS


    "Richard" <Richard@discussions.microsoft.com> wrote in message
    news:DD28F95E-58CF-4961-A3AD-E37FC68AE0F4@microsoft.com...
    > 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. #4
    Nick Hodge
    Guest

    Re: 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
    nick_hodgeTAKETHISOUT@zen.co.uk.ANDTHIS


    "Richard" <Richard@discussions.microsoft.com> wrote in message
    news:DD28F95E-58CF-4961-A3AD-E37FC68AE0F4@microsoft.com...
    > 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 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