+ Reply to Thread
Results 1 to 2 of 2

delete row if a cell is blank

  1. #1
    Steve Mackay
    Guest

    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. #2
    Steve Mackay
    Guest

    Re: 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).EntireRow.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 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