Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do you create an Array of Arrays?
Hi
Use simply a single multi-dimensional array: Dim Data(days,parameters+1) As Variant creates an array, where in Data(1,1) to Data(days,1) you can store all your dates, and in Data(n,2) to Data(n,parameters+1) you can store all parameters for n-th date. You can visualize it as a table Date, Parameter1, Parameter2, ... Arvi Laanemets "BFike" wrote in message ... I have an array, Dates(), which I want to contain arrays of Days(). Thus Jan 1, 2006 is a Day which I then want to store in Dates. So Dates(1) would store all of the associated information for that Day. Here is the code that I have now. I do not consider myself to be a good programmer by any means so suggestions are welcome. The Arrays, limit, and dayz are all public. Here is the code where I load the Array of Arrays: Range("F28").Select Set myRange = Range("F28") ReDim Dates(1 To dayz) For j = 1 To dayz ReDim Days(1 To limit) Dates(j) = Days() For i = 1 To limit Days(i) = ActiveCell.Value ActiveCell.Offset(1, 0).Activate Next i myRange.Offset(0, j).Activate Next j Here is the code where I try to do something sum up the values and then write to the sheet but I keep getting the same Days array values over and over. Sub Sum_Days_Region() Dim i, x, a, j As Variant Dim sum() Sheets("Total").Select Range("A406").Select Range(Selection, Selection.End(xlDown)).Select ReDim sum(1 To dayz) For Each x In Selection For j = 1 To dayz Dates(j) = Days() For i = 1 To limit If District(i) & " - " & Brand(i) = x.Value Then sum(j) = sum(j) + Days(i) End If Next i Next j Range(x.Address).Select ActiveCell.Offset(0, 28).Activate For a = 1 To dayz ActiveCell.Value = sum(a) ActiveCell.Offset(0, 1).Activate sum(a) = 0 Next a Next x End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to Access Array of Arrays? | Excel Programming | |||
Array of Public Arrays | Excel Programming | |||
array of arrays stored in Name: POSSIBLE? | Excel Programming | |||
Array of Arrays in VBA | Excel Programming | |||
Extracting sub arrays from a 2-D VBA array | Excel Programming |