VB Newbie - Counting occurences in array
How about simply:
For i = 0 to Ubound(Harray)
If Harray(i) = "test" then
n = n + 1
End If
Next
Msgbox n
RBS
"SJC" wrote in message
...
I'm sure this is a really basic question but it has me stumped. I'm taking
the text strings in a user-defined range, converting them using a custom
function and putting the converted string into an array. I now need to
count the number of ocurrences of each string within the array to test for
duplicates. The conversion runs as follows:
i = 0
For Each cell In UserRange
Surname = cell.Value
Harray(i) = HOADEX(Surname)
i = i + 1
Next cell
Harray is Dim'd as string and HOADEX is the custom function. How do I
count the number of times a given string appears in the array?
|