Silverjman
Board Regular
- Joined
- Mar 19, 2014
- Messages
- 110
OK, from all I've read passing an array from one sub to another is easy, but when I try to do it here the VBA Macro window pops open and my code stops.
I have tried to read everything else out there that tries to address this but no amount of defining or deleting of `()` helps.
FULL CODE
I have tried to read everything else out there that tries to address this but no amount of defining or deleting of `()` helps.
Code:
Sub Costs__Max_Legal_Physical_Possession_Period(arrCosts__Physical_Possession(), arrCosts__Legal_Possession())
arrQuarters = Range("Quarters_1to40")
arrPhysical_Possession_Expenses_From_Quarter = Range("Costs.Physical_Possession_Expenses_From_Quarter")
arrPhysical_Possession_Expenses_To_Quarter = Range("Costs.Physical_Possession_Expenses_To_Quarter")
arrLegal_Possession_Expenses_From_Quarter = Range("Costs.Legal_Possession_Expenses_From_Quarter")
arrLegal_Possession_Expenses_To_Quarter = Range("Costs.Legal_Possession_Expenses_To_Quarter")
ReDim arrCosts__Max_Legal_Possession(1 To UBound(arrLegal_Possession_Expenses_To_Quarter, 1), 1 To UBound(arrQuarters, 2))
For I = LBound(arrLegal_Possession_Expenses_To_Quarter, 1) To UBound(arrLegal_Possession_Expenses_To_Quarter, 1)
For J = LBound(arrQuarters, 2) To UBound(arrQuarters, 2)
arrCosts__Max_Legal_Possession(I, J) = WorksheetFunction.Max(arrCosts__Physical_Possession(I, J), arrCosts__Legal_Possession(I, J))
Next
Next
End Sub
FULL CODE
Code:
Sub Costs__Legal_Possession()
Dim arrQuarters, arrLegal_Possession_Expenses_From_Quarter, arrLegal_Possession_Expenses_To_Quarter, arrCosts__Legal_Possession, I, J
arrQuarters = Range("Quarters_1to40")
arrLegal_Possession_Expenses_From_Quarter = Range("Costs.Legal_Possession_Expenses_From_Quarter")
arrLegal_Possession_Expenses_To_Quarter = Range("Costs.Legal_Possession_Expenses_To_Quarter")
ReDim arrCosts__Legal_Possession(1 To UBound(arrLegal_Possession_Expenses_To_Quarter, 1), 1 To UBound(arrQuarters, 2))
For I = LBound(arrLegal_Possession_Expenses_To_Quarter, 1) To UBound(arrLegal_Possession_Expenses_To_Quarter, 1)
For J = LBound(arrQuarters, 2) To UBound(arrQuarters, 2)
arrCosts__Legal_Possession(I, J) = (arrQuarters(1, J) >= arrLegal_Possession_Expenses_From_Quarter(I, 1)) * (arrQuarters(1, J) <= arrLegal_Possession_Expenses_To_Quarter(I, 1)) * 1
Next
Next
End Sub
Sub Costs__Physical_Possession()
Dim arrQuarters, arrPhysical_Possession_Expenses_From_Quarter, arrPhysical_Possession_Expenses_To_Quarter, arrCosts__Physical_Possession, I, J
arrQuarters = Range("Quarters_1to40")
arrPhysical_Possession_Expenses_From_Quarter = Range("Costs.Physical_Possession_Expenses_From_Quarter")
arrPhysical_Possession_Expenses_To_Quarter = Range("Costs.Physical_Possession_Expenses_To_Quarter")
ReDim arrCosts__Physical_Possession(1 To UBound(arrPhysical_Possession_Expenses_To_Quarter, 1), 1 To UBound(arrQuarters, 2))
For I = LBound(arrPhysical_Possession_Expenses_To_Quarter, 1) To UBound(arrPhysical_Possession_Expenses_To_Quarter, 1)
For J = LBound(arrQuarters, 2) To UBound(arrQuarters, 2)
arrCosts__Physical_Possession(I, J) = (arrQuarters(1, J) >= arrPhysical_Possession_Expenses_From_Quarter(I, 1)) * (arrQuarters(1, J) <= arrPhysical_Possession_Expenses_To_Quarter(I, 1)) * 1
Next
Next
End Sub
Sub Costs__Max_Legal_Physical_Possession_Period(arrCosts__Physical_Possession(), arrCosts__Legal_Possession())
arrQuarters = Range("Quarters_1to40")
arrPhysical_Possession_Expenses_From_Quarter = Range("Costs.Physical_Possession_Expenses_From_Quarter")
arrPhysical_Possession_Expenses_To_Quarter = Range("Costs.Physical_Possession_Expenses_To_Quarter")
arrLegal_Possession_Expenses_From_Quarter = Range("Costs.Legal_Possession_Expenses_From_Quarter")
arrLegal_Possession_Expenses_To_Quarter = Range("Costs.Legal_Possession_Expenses_To_Quarter")
ReDim arrCosts__Max_Legal_Possession(1 To UBound(arrLegal_Possession_Expenses_To_Quarter, 1), 1 To UBound(arrQuarters, 2))
For I = LBound(arrLegal_Possession_Expenses_To_Quarter, 1) To UBound(arrLegal_Possession_Expenses_To_Quarter, 1)
For J = LBound(arrQuarters, 2) To UBound(arrQuarters, 2)
arrCosts__Max_Legal_Possession(I, J) = WorksheetFunction.Max(arrCosts__Physical_Possession(I, J), arrCosts__Legal_Possession(I, J))
Next
Next
End Sub