Consulting

Results 1 to 4 of 4

Thread: Delete row based on 3 conditions

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Delete row based on 3 conditions

    Hi,

    I have a macro that deletes a row if two cells have different value (cells in column A and G).

    I would now like to add two more conditions in order to proceed with deleting row:

    1. the cell in column G is numeric (as opposed to text).
    2. the cell in column B does not contain word "Final"

    Dim wFinalResult As Worksheet
     
    ActiveWorkbook.Sheets("FinalResult").Activate
     
    Set wFinalResult = ActiveSheet
     
    Dim N As Long, i As Long
        N = Cells(Rows.Count, "A").End(xlUp).Row
        For i = N To 2 Step -1
            If Cells(i, "A").Value <> Cells(i, "G").Value Then
                Cells(i, "A").EntireRow.Delete
            End If
        Next i
    End Sub
    How would I do that?

    Nic
    Last edited by Nicolaf; 04-16-2015 at 09:54 AM. Reason: Solved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •