+ Reply to Thread
Results 1 to 3 of 3

delete row based on column value??

  1. #1
    Registered User
    Join Date
    09-30-2005
    Posts
    3

    delete row based on column value??

    I would like to delete a row if the value in a column is zero. How could I do that with a simple macro? I am not that savvy when it comes to Excel.

    Thanks

  2. #2
    Dave Peterson
    Guest

    Re: delete row based on column value??

    Maybe apply Data|Filter|autofilter
    show that value and delete the visible rows.
    and show all the data

    Recording a macro when you do it manually will give you the code.

    elkins wrote:
    >
    > I would like to delete a row if the value in a column is zero. How
    > could I do that with a simple macro? I am not that savvy when it comes
    > to Excel.
    >
    > Thanks
    >
    > --
    > elkins
    > ------------------------------------------------------------------------
    > elkins's Profile: http://www.excelforum.com/member.php...o&userid=27707
    > View this thread: http://www.excelforum.com/showthread...hreadid=473963


    --

    Dave Peterson

  3. #3
    Robert Mulroney
    Guest

    RE: delete row based on column value??

    What about this:

    '___________________________________________________________

    Public Sub deleteEmptyRow()

    For Each rw In Selection.Cells

    If rw.Cells(1, 1) = "" Then
    rw.Cells(1, 1).EntireRow.Delete
    End If
    Next

    End Sub

    '___________________________________________________________

    Of course that requires the "test" column to be highlighted. It's best to
    only highlight a single column on the rows that you want to test (ie not the
    whole column). You could also replace:

    For Each rw In Selection.Cells

    with

    For Each rw In range("A1:A100")

    or some other range as needed. If you want to test for a particular value
    just put that value between the " ".

    - Rm


    "elkins" wrote:

    >
    > I would like to delete a row if the value in a column is zero. How
    > could I do that with a simple macro? I am not that savvy when it comes
    > to Excel.
    >
    > Thanks
    >
    >
    > --
    > elkins
    > ------------------------------------------------------------------------
    > elkins's Profile: http://www.excelforum.com/member.php...o&userid=27707
    > View this thread: http://www.excelforum.com/showthread...hreadid=473963
    >
    >


+ 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