R
Rpettis31
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
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