title: Delete Rows With Duplicate Data VBA
body: <p>I am struggling with something that should be fairly straightforward, however, I have read at least 15 methods of doing this and cannot seem to get it to work.</p>
  
  <p>Here is a sample dataset:</p>
  
  <pre><code>9:30:01 584.7
  9:30:01 590
  9:30:01 595
  9:30:02 584.51
  9:30:03 584.62
  9:30:04 584.44
  9:30:05 584.05
  </code></pre>
  
  <p>I only want one row per second, so of the first 3 rows, only one needs to stay.  I don't care if it is the first or the last, but the code I have been using keeps the last, 595 in this case.</p>
  
  <p>The way I am doing it is with a for loop that clears the contents of the row that has the same time as the row below it.  I then sort the entire range.</p>
  
  <p>I imagine there is a simpler way to simply delete the extra row from the get go.  However, when I use delete on the range, instead of clear, it won't remove all of the duplicate rows.</p>
  
  <p>Here is what I want the data to look like:</p>
  
  <pre><code>9:30:01 595
  9:30:02 584.51
  9:30:03 584.62
  9:30:04 584.44
  9:30:05 584.05
  </code></pre>
  
  <p>I need this to happen for the entire sheet.  The time is Column B and the values are column C.</p>
  
  <p>Here is the code I am using,</p>
  
  <pre><code>LastRow = ActiveSheet.UsedRange.row - 1 + _
      ActiveSheet.UsedRange.Rows.Count
  
  For RowNum = 2 To LastRow
      If (Range("B" &amp; RowNum) = Range("B" &amp; RowNum + 1)) Then
      Range("B" &amp; RowNum).EntireRow.Clear
      End If
  Next RowNum
  
  Range("A2:C" &amp; LastRow).Sort key1:=Range("B2:B" &amp; LastRow), _
  order1:=xlAscending, Header:=xlNo
  </code></pre>