ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Reading a VBA Array - Thanks (https://www.excelbanter.com/excel-programming/315280-re-reading-vba-array-thanks.html)

SMS - John Howard

Reading a VBA Array - Thanks
 
Dough and RBS,

Many thanks for the effort you put into your solutions.

Both work admirably.

I have experimented with them both and whilst I now understand How they work
I need to explore more into Why they work.

Once again many thanks
You have enabled solve a long standing work problem

Regards

John



"SMS - John Howard" wrote in message
...
The worksheet formula:
=Frequency(A2:A10,B2:B5) applied to the below sample worksheet works fine
and produces the correct array 1, 2, 4, 2

A B
1 Scores Bins
2 79 70
3 85 79
4 78 89
5 85
6 50
7 81
8 95
9 88
10 97

Yet this VBA Macro;

Dim Frq() As Variant
Sub Freq()

Frq = Evaluate("=Frequency(A2:A10,B2:B5)")
x = UBound(Frq)
ReDim Frq(x)
For c = LBound(Frq) To UBound(Frq)
Debug.Print Frq(c)
Next c

End Sub

produces a null for each element of the For Next Loop.

Can anyone tell me why?

TIA
John Howard






All times are GMT +1. The time now is 05:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com