delete single occurances in a string
I think this macro should do what you want (just change the example
worksheet name I used in the With statement to your actual worksheet's
name)...
Sub DeleteSingleEntriesInColumnB()
Dim X As Long, LastRow As Long, U As Range
Const FirstRow As Long = 6
With Worksheets("Sheet1")
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
For X = FirstRow To LastRow
If WorksheetFunction.CountIf(.Range("B" & FirstRow & _
":B" & LastRow), .Cells(X, "B")) = 1 Then
If U Is Nothing Then
Set U = .Rows(X)
Else
Set U = Union(U, .Rows(X))
End If
End If
Next
End With
U.Delete
End Sub
--
Rick (MVP - Excel)
"J.W. Aldridge" wrote in message
...
i have headers in a5:g5
I have data in columns A6:G5000.
based on the series of numbers in column b, i want to delete all
single occurances of the number found.
In other words, if it is not listed/found in column B at least twice,
delete the entire row.
|