Re: ReDim V(1 To 10): Gives Row or Column?
Hi...
Thanks, everyone, for your advice and suggestions.
Also, Andy Pope, much obliged for your set of 2 alternative codes to tackle my problem earlier. I used the 2nd code you provided as I found it a little easier to understand – and it works beautifully. Gratzi…
In another worksheet, my end objective remains much the same, i.e. populate a newly dimensioned array ZZ(N, M), EXCEPT this time I do NOT have a ready range of pre-calculated cells in the worksheet.
Now, I require the ‘FOR’ loop to call another Public Function ‘probcalc’, with header:
‘Public Function probcalc(s As Range) as Variant’
a total of M times, and each iteration i=1 To M results in ‘probcalc’ returning an N-element COLUMN vector - which is conveniently assigned to column i of array ZZ.
How does one modify (Andy Pope's earlier) code below to incorporate this function call feature?
P.S. Also, I'm afraid the 'Debug.Print' functionality called upon in the code below may not be suitable for my new purpose, as array ZZ above is ONLY an INTERMEDIATE STORAGE array of sorts which I do NOT want printed/reproduced on the Excel worksheet at all - reason being elements of populated array ZZ will selectively be used in additional code thereafter to arrive at the final answer.
Apologies if my explanation above sounds too gibberish, but hope you VBA gurus will easily understand what I need to program - and advise accordingly.
Thanks a million in advance... - Om Avataar
Sub Y()
Dim V(10, 8)
Dim intLoop1 As Integer
Dim intLoop2 As Integer
Dim rngTemp As Range
For Each rngTemp In Range("A1:H10")
V(rngTemp.Row, rngTemp.Column) = rngTemp.Value
Next rngTemp
For intLoop1 = LBound(V, 1) To UBound(V, 1)
For intLoop2 = LBound(V, 2) To UBound(V, 2)
Debug.Print intLoop1, intLoop2, V(intLoop1, intLoop2)
Next intLoop2
Next intLoop1
End Sub
Display More