Error in using "Frequency" function in VBA code

  • Thread starter Thread starter Gregg Ferguson
  • Start date Start date
G

Gregg Ferguson

I am using the following code to return a frequency distribution using
VBA in Excel:

myrange = Application.WorksheetFunction.Frequency(graph,
Range("bin"))
Range("af1:af17").Value = myrange

Where:
1) myrange is a variant
2) graph is a variant array with X rows and 1 column where X can be
anywhere from 1,000 to approximately 200,000
3) Range("bin") is named range that consists of 12 rows and 1 column

This appears to work correctly when the size of the graph array is
less than about 5000 rows. Using values in excess of about 5000 rows
produces the error message - " Run time error 13 - Type mismatch". I
need to do this when the size of graph approaches 100,000 to 200,000
rows. Any thoughts? Thank you!!!!!!
 
If the size is greater than 5461 elements then you get the error. This is
the limit on array arguments to worksheet functions.

You need to put your data down on a worksheet, possibly breaking it into
multiple columns.
 
Back
Top