View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
PY & Associates[_2_] PY & Associates[_2_] is offline
external usenet poster
 
Posts: 38
Default finding unique values and removing all duplicates

On May 4, 3:39*am, waylonk wrote:
I have a spread sheet with 4 columns and 900 rows I am trying to identify the
rows that do not contain a duplicate amount. *For example I have rows with

100
100
97
97
96
96
98 *
101

I am trying to pull the list of 98 and 101. *The spreadsheet is a list of
invoices paid vs invoices unpaid if it is paid there are two rows with the
same data if it is unpaid there is only one row. *I am trying to find the
unpaid invoices.


Something like this, assuming data in column B1 down

Option Explicit

Sub m()
Dim i As Integer
Dim lrow As Integer

lrow = Cells(Rows.Count, "B").End(xlUp).Row

For i = 1 To lrow
If Cells(i, "B") = Cells(i + 1, "B") Then
i = i + 1
Else
Cells(i, "B").Interior.Color = vbYellow
End If
Next i

End Sub