The
VB collection is quite slow and COUNTU can be made about 8 times
faster by using the cCollection object that is in the free file
dhRichClient3:
www.datenhaus.de/Downloads/dhRichClient3.zip
http://www.datenhaus.de/Downloads/dh...ient3-Demo.zip
Using that COUNTU would be something like this:
Public Function COUNTU2(theRange As Range) As Variant
Dim i As Long
Dim cCol As cCollection
Dim vCell As Variant
Dim vArr As Variant
Dim oRng As Range
Set oRng = Intersect(theRange, theRange.Parent.UsedRange)
vArr = oRng
Set cCol = New cCollection
cCol.CompatibleToVBCollection = False
For Each vCell In vArr
If cCol.Exists(vCell) = False Then
cCol.Add 0, vCell
End If
Next vCell
COUNTU2 = cCol.Count
End Function
RBS
"Bernd P" wrote in message
...
Hello,
Look at my runtime comparisons, I suggest:
http://www.sulprobil.com/html/count_unique.html
Regards,
Bernd