View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
SJC[_2_] SJC[_2_] is offline
external usenet poster
 
Posts: 10
Default VB Newbie - Counting occurences in array

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?