Overwrite the existing code with this modified version...
Sub GetUniqueList()
Const lOUTPUT_COLUMN = 1
Const lCOUNT_COLUMN = 2
Const sSTART_CELL = "A1"
Dim wbkOutBook As Workbook
Dim wshOutSheet As Worksheet
Dim wshSource As Worksheet
Dim rngReadCell As Range
Dim rngMatchValue As Range
Dim lWriteRow As Long
Dim lLastRow As Long
Set wshSource = ActiveSheet
Set wbkOutBook = Workbooks.Add
Set wshOutSheet = wbkOutBook.Sheets(1)
Set rngReadCell = wshSource.Range(sSTART_CELL)
With wshSource
lLastRow=.Cells(.Rows.Count,.Range(sSTART_CELL).Column).End(xlUp).Row
End With
With wshOutSheet
While rngReadCell.Row <= lLastRow
If rngReadCell.Value<>"" Then
Set rngMatchValue = .Columns(lOUTPUT_COLUMN).Find(rngReadCell.Value, LookIn:=xlValues, lookat:=xlWhole, MatchCase:=False)
If rngMatchValue Is Nothing Then
lWriteRow = .Cells(.Rows.Count, lOUTPUT_COLUMN).End(xlUp).Row + 1
.Cells(lWriteRow, lOUTPUT_COLUMN).Value = rngReadCell.Value
.Cells(lWriteRow, lCOUNT_COLUMN).Value = 1
Else
rngMatchValue.EntireRow.Cells(lCOUNT_COLUMN).Value = rngMatchValue.EntireRow.Cells(lCOUNT_COLUMN).Value + 1
End If
End If
Set rngReadCell = rngReadCell.Offset(1, 0)
Wend
End With
End Sub
Bookmarks