+ Reply to Thread
Results 1 to 5 of 5

Delete specified critria rows

  1. #1
    rn
    Guest

    Delete specified critria rows

    Hi

    What code can I use to delete rows based on the values of
    two fields/columns on the same row. (if cell A1 is not
    blank and cell B1=0 delete)

    Thanks.

  2. #2
    Bob Phillips
    Guest

    Re: Delete specified critria rows

    Insert a row at the top, and then a spare column, add

    =AND(A2<>"",B2=0)

    Select this column and Menu Data>AuItofilter.
    Click the dropdown and select TRUE from the list
    Delete all visible rows, including row 1

    All done


    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "rn" <[email protected]> wrote in message
    news:[email protected]...
    > Hi
    >
    > What code can I use to delete rows based on the values of
    > two fields/columns on the same row. (if cell A1 is not
    > blank and cell B1=0 delete)
    >
    > Thanks.




  3. #3
    Jason Morin
    Guest

    Re: Delete specified critria rows

    Sub DeleteRows()
    Dim iLastRow As Long
    Dim i As Long

    Application.ScreenUpdating = False

    iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    For i = iLastRow To 1 Step -1
    With Cells(i, "A")
    If .Value <> "" And _
    .Offset(0, 1).Value = 0 Then
    .EntireRow.Delete
    End If
    End With
    Next i

    Application.ScreenUpdating = True

    End Sub

    ---
    HTH
    Jason
    Atlanta, GA

    >-----Original Message-----
    >Hi
    >
    >What code can I use to delete rows based on the values

    of
    >two fields/columns on the same row. (if cell A1 is not
    >blank and cell B1=0 delete)
    >
    >Thanks.
    >.
    >


  4. #4
    rn
    Guest

    Re: Delete specified critria rows

    Thanks for your help.


    >-----Original Message-----
    >Sub DeleteRows()
    >Dim iLastRow As Long
    >Dim i As Long
    >
    >Application.ScreenUpdating = False
    >
    >iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    >For i = iLastRow To 1 Step -1
    > With Cells(i, "A")
    > If .Value <> "" And _
    > .Offset(0, 1).Value = 0 Then
    > .EntireRow.Delete
    > End If
    > End With
    >Next i
    >
    >Application.ScreenUpdating = True
    >
    >End Sub
    >
    >---
    >HTH
    >Jason
    >Atlanta, GA
    >
    >>-----Original Message-----
    >>Hi
    >>
    >>What code can I use to delete rows based on the values

    >of
    >>two fields/columns on the same row. (if cell A1 is not
    >>blank and cell B1=0 delete)
    >>
    >>Thanks.
    >>.
    >>

    >.
    >


  5. #5
    rn
    Guest

    Re: Delete specified critria rows

    Thanks.


    >-----Original Message-----
    >Insert a row at the top, and then a spare column, add
    >
    >=AND(A2<>"",B2=0)
    >
    >Select this column and Menu Data>AuItofilter.
    >Click the dropdown and select TRUE from the list
    >Delete all visible rows, including row 1
    >
    >All done
    >
    >
    >--
    >
    >HTH
    >
    >RP
    >(remove nothere from the email address if mailing direct)
    >
    >
    >"rn" <[email protected]> wrote in

    message
    >news:[email protected]...
    >> Hi
    >>
    >> What code can I use to delete rows based on the values

    of
    >> two fields/columns on the same row. (if cell A1 is not
    >> blank and cell B1=0 delete)
    >>
    >> Thanks.

    >
    >
    >.
    >


+ 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