Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default How do you create an Array of Arrays?

Another option is to use an array of types:

Private Type Days
Num() As Date
End Type

Const Dft As Long = 10

Private Sub CommandButton1_Click()
Dim Data() As Days
Dim i As Long

ReDim Data(1 To Dft)

For i = 1 To Dft
ReDim Data(i).Num(i)
Next

End Sub

NickHK

"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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you create an Array of Arrays? Arvi Laanemets Excel Programming 0 December 21st 06 06:35 PM
How to Access Array of Arrays? billbell52 Excel Programming 1 February 24th 05 06:05 PM
array of arrays stored in Name: POSSIBLE? [email protected][_2_] Excel Programming 1 December 21st 04 10:55 PM
Array of Arrays in VBA Peter[_49_] Excel Programming 0 November 9th 04 09:50 PM
Extracting sub arrays from a 2-D VBA array Alan Beban[_2_] Excel Programming 7 August 16th 04 09:50 PM


All times are GMT +1. The time now is 02:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"