View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Error in using "Frequency" function in VBA code

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.

--
Regards,
Tom Ogilvy

Gregg Ferguson wrote in message
om...
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

Whe
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!!!!!!