Home > Software engineering >  VBA fuction process how to output a two-dimensional array
VBA fuction process how to output a two-dimensional array

Time:11-14

I need a custom function, function is: do a range of cell number statistics, finally shows every number in the number of words, according to the first listed as number, the second a number the number of occurrences of displayed, the following is my make up the function, doesn't work, don't know where in addition to the problem, the great god solve please, PS: teacher asked can't use the dictionary function,,,
The Function ss (myarray on)
Dim arr (), n %, I, j, coun
N=0
Coun=1
For I=1 To UBound (myarray on) - 1
If myarray on (I) & lt;> "" Then
N=n + 1
ReDim Preserve arr (2, 1 To n)
For j=I + 1 To UBound (myarray on)
If myarray on (I)=myarray on (j) Then
Coun=coun + 1
Arr (1, n)=myarray on (I)
Arr (2, n)=coun
Myarray on (j)=""
The Else
Arr (1, n)=myarray on (I)
Arr (2, n)=coun
End the If
Next j
Coun=1
End the If
Next I


Ss=Application. Transpose (arr)

End the Function
  •  Tags:  
  • VBA
  • Related