title: Deleting row if there is another row with same value in column A and that row has value in c
body: <p>I'm trying to write a macro that does the following:</p>
  
  <ol>
  <li>it takes the value of column A - row per row (from down to up) = initial row</li>
  <li>it checks if there is another row with the same value in column A</li>
  <li>if yes: it takes the first match</li>
  <li>it checks if the matched row has something written in column C</li>
  <li>if yes: it deletes the initial row</li>
  </ol>
  
  <p>I have the following but it doesn't work and now it seems that there is also the error "unable to get the Match property of the worksheetfunction class.</p>
  
  <pre><code>Option Explicit
  
  Sub Testing()
  
  Dim x               As Long
  Dim y               As Long
  Dim LastRow         As Long
  Dim MatchedRow      As Long
  Dim RowValue        As String
  
  LastRow = Range("A999999").End(xlUp).Row
  
  For x = LastRow To 1 Step -1
  
  RowValue = Range("A" &amp; x).Value
  
  If Application.WorksheetFunction.CountIf(Range("A1:A" &amp; x), Range("A" &amp; x).Text) &gt; 1 Then
      MatchedRow = Application.WorksheetFunction.Match(RowValue, Range("A1:A" &amp; x), 0)
      If Range("C" &amp; MatchedRow).Value &lt;&gt; "" Then
          Range("A" &amp; x).EntireRow.Delete
      End If
  End If
  
  Next x
  
  End Sub
  </code></pre>
  
  <p>I hope someone can help.</p>