If value occurs more than once then delete all of them
Hi Howard,
Am Mon, 7 Jul 2014 09:04:56 +0200 schrieb Claus Busch:
ReDim Preserve varData(.UsedRange.Cells.Count)
sorry, the array will only have the unique values and not all values in
UsedRange:
Sub LoneValueStay2()
Dim varData() As Variant
Dim rngC As Range
Dim i As Long
With Sheets("Sheet1")
For Each rngC In .UsedRange
If WorksheetFunction.CountIf(.UsedRange, rngC) = 1 Then
ReDim Preserve varData(i)
varData(i) = rngC
i = i + 1
End If
Next
'// Write result to sheet.
.Range("F1").Resize(UBound(varData) + 1, 1) = _
Application.Transpose(varData)
End With
End Sub
Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
|