title: VBA: Delete one row if values match
body: <p>I am trying to create a macro that looks for <strong>"Total net</strong>" and <strong>"Program Operation net"</strong> in column C. Once located, the macro compares the rows of these two cells and of their values match then row of <strong>"Total Net"</strong> get deleted.</p>
  
  <p>This is my code so far...</p>
  
  <pre><code>Sub DeletingEmptyPages()
  Dim WS As Worksheet
  For Each WS In Sheets
  
  Dim Mystring As String
  Dim MystringII As String
  
  MystringII = "Total Net"
  Mystring = "Program Operating Net"
  
  
    Dim n As Long
    Dim nlast As Long
    Dim rw As Range
    Set rw = ActiveWorkbook.ActiveSheet.UsedRange.Rows
    nlast = rw.count
    For n = nlast To 9 Step -1
        If (Column(c).Value = MystringII And Column(c).Value = Mystring) Then
        rw.Rows(n).Delete
  
        End If
        Next n
        Next WS
        End Sub
  </code></pre>