Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Multidimensional Array

I am trying to set my code with an array to obtain values. For example
pieces per month by factory. I was hoping to store the factory name as the
parent and the child array as the totals per month. Currently I have this as
a static array.
' Prepaid Inventory
Dim PrePaid(1 To 12) As Currency
Dim PrePaid1(1 To 12) As Currency
Dim PrePaid2(1 To 12) As Currency
Dim PrePaid3(1 To 12) As Currency

Dim ArrFactory(1 To 4) As String
ArrFactory(1) = "Panan Jiayuan Househ"
ArrFactory(2) = "Xianju Fenda - New"
ArrFactory(3) = "Curug"
ArrFactory(4) = "PT Astari"


Dim arrCount As Integer
Dim n As Integer
Dim g As Integer
n = 43 'Plan Prod
g = 38 'Reciepts by month

For Accum = 1 To 12

For arrCount = 2 To 2000

Select Case Cells(arrCount, 6)

Case ArrFactory(1, 0)

PrePaid(Accum) = PrePaid(Accum) + (Cells(arrCount, g) *
Cells(arrCount, 13))
If g 42 Then _
PrePaid(Accum) = PrePaid(Accum) + (Cells(arrCount, n) *
Cells(arrCount, 13))

Case ArrFactory(1)
PrePaid1(Accum) = PrePaid1(Accum) + (Cells(arrCount, g) *
Cells(arrCount, 13))
If g 42 Then _
PrePaid1(Accum) = PrePaid1(Accum) + (Cells(arrCount, n) *
Cells(arrCount, 13))

End Select
Next arrCount
n = n + 6
g = g + 6

Next Accum
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Multidimensional Array

From
Dim PrePaid(1 To 12) As Currency
Dim PrePaid1(1 To 12) As Currency
Dim PrePaid2(1 To 12) As Currency
Dim PrePaid3(1 To 12) As Currency

to
Dim PrePaid(1 To 12, 4) As Currency
Dim PrePaid1(1 To 12, 4) As Currency
Dim PrePaid2(1 To 12, 4) As Currency
Dim PrePaid3(1 To 12, 4) As Currency


Or

from
Dim ArrFactory(1 To 4) As String

to
Dim ArrFactory(1 To 4, 12) As String




"Rpettis31" wrote:

I am trying to set my code with an array to obtain values. For example
pieces per month by factory. I was hoping to store the factory name as the
parent and the child array as the totals per month. Currently I have this as
a static array.
' Prepaid Inventory
Dim PrePaid(1 To 12) As Currency
Dim PrePaid1(1 To 12) As Currency
Dim PrePaid2(1 To 12) As Currency
Dim PrePaid3(1 To 12) As Currency

Dim ArrFactory(1 To 4) As String
ArrFactory(1) = "Panan Jiayuan Househ"
ArrFactory(2) = "Xianju Fenda - New"
ArrFactory(3) = "Curug"
ArrFactory(4) = "PT Astari"


Dim arrCount As Integer
Dim n As Integer
Dim g As Integer
n = 43 'Plan Prod
g = 38 'Reciepts by month

For Accum = 1 To 12

For arrCount = 2 To 2000

Select Case Cells(arrCount, 6)

Case ArrFactory(1, 0)

PrePaid(Accum) = PrePaid(Accum) + (Cells(arrCount, g) *
Cells(arrCount, 13))
If g 42 Then _
PrePaid(Accum) = PrePaid(Accum) + (Cells(arrCount, n) *
Cells(arrCount, 13))

Case ArrFactory(1)
PrePaid1(Accum) = PrePaid1(Accum) + (Cells(arrCount, g) *
Cells(arrCount, 13))
If g 42 Then _
PrePaid1(Accum) = PrePaid1(Accum) + (Cells(arrCount, n) *
Cells(arrCount, 13))

End Select
Next arrCount
n = n + 6
g = g + 6

Next Accum

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Multidimensional Array

What is a "parent" array?
What is a "child" array?
What version of XL are you using?
And what is your question?
--
Jim Cone
Portland, Oregon USA



"Rpettis31"

wrote in message
I am trying to set my code with an array to obtain values. For example
pieces per month by factory. I was hoping to store the factory name as the
parent and the child array as the totals per month. Currently I have this as
a static array.
' Prepaid Inventory
Dim PrePaid(1 To 12) As Currency
Dim PrePaid1(1 To 12) As Currency
Dim PrePaid2(1 To 12) As Currency
Dim PrePaid3(1 To 12) As Currency

Dim ArrFactory(1 To 4) As String
ArrFactory(1) = "Panan Jiayuan Househ"
ArrFactory(2) = "Xianju Fenda - New"
ArrFactory(3) = "Curug"
ArrFactory(4) = "PT Astari"


Dim arrCount As Integer
Dim n As Integer
Dim g As Integer
n = 43 'Plan Prod
g = 38 'Reciepts by month

For Accum = 1 To 12
For arrCount = 2 To 2000
Select Case Cells(arrCount, 6)
Case ArrFactory(1, 0)
PrePaid(Accum) = PrePaid(Accum) + (Cells(arrCount, g) *
Cells(arrCount, 13))
If g 42 Then _
PrePaid(Accum) = PrePaid(Accum) + (Cells(arrCount, n) *
Cells(arrCount, 13))

Case ArrFactory(1)
PrePaid1(Accum) = PrePaid1(Accum) + (Cells(arrCount, g) *
Cells(arrCount, 13))
If g 42 Then _
PrePaid1(Accum) = PrePaid1(Accum) + (Cells(arrCount, n) *
Cells(arrCount, 13))
End Select
Next arrCount
n = n + 6
g = g + 6
Next Accum
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
multidimensional array ranswert Excel Programming 2 January 17th 08 01:22 AM
multidimensional array Peter[_61_] Excel Programming 1 August 30th 07 05:34 PM
Multidimensional array - lookup Jason Morin Excel Programming 5 September 27th 06 06:49 PM
Multidimensional Array DavidMoeller Excel Programming 4 August 12th 04 08:12 PM
MAX of Multidimensional Array ZZZ Excel Programming 2 November 15th 03 03:32 PM


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

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"