If value occurs more than once then delete all of them
On Monday, July 7, 2014 12:20:15 AM UTC-7, Claus Busch wrote:
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.
That's a winner, thanks.
Regards,
Howard
|