cortexnotion
Board Regular
- Joined
- Jan 22, 2020
- Messages
- 150
- Office Version
- 2013
- Platform
- Windows
Hi All
I am looping in an array to get the total figures and then another loop to individual figures which makes the code rather long. I was wondering if the Tech loop could be incorporated into the main loop?
Below is an extract from my code:
Many thanks!
I am looping in an array to get the total figures and then another loop to individual figures which makes the code rather long. I was wondering if the Tech loop could be incorporated into the main loop?
Below is an extract from my code:
Many thanks!
VBA Code:
d = 1
If CDShtAry(e, 3) >= LW2 And CDShtAry(e, 3) <= LW1 And CDShtAry(e, 4) = "Completed" Then
If CDShtAry(e, 15) <= CDSLA Then
CompAry(d, 11) = CompAry(d, 11) + 1
CompAry(d, 12) = CompAry(d, 12) + CDShtAry(e, 11)
CompAry(d, 13) = CompAry(d, 13) + CDShtAry(e, 12)
ElseIf CDShtAry(e, 15) > CDSLA Then
CompAry(d, 14) = CompAry(d, 14) + 1
CompAry(d, 15) = CompAry(d, 15) + CDShtAry(e, 11)
CompAry(d, 16) = CompAry(d, 16) + CDShtAry(e, 12)
End If
CompAry(d, 17) = CompAry(d, 17) + CDShtAry(e, 14)
CompAry(d, 18) = 0
End If
Next e
d = 2
For Each Tech In TechAry
For f = LBound(CDShtAry) To UBound(CDShtAry)
CompAry(d, 1) = LW1
CompAry(d, 2) = Tech
If CDShtAry(f, 3) >= LW2 And CDShtAry(f, 3) <= LW1 And CDShtAry(f, 4) = "Completed" And CDShtAry(f, 5) = Tech Then
If CDShtAry(f, 15) <= CDSLA Then
CompAry(d, 11) = CompAry(d, 11) + 1
CompAry(d, 12) = CompAry(d, 12) + CDShtAry(f, 11)
CompAry(d, 13) = CompAry(d, 13) + CDShtAry(f, 12)
ElseIf CDShtAry(f, 15) > CDSLA Then
CompAry(d, 14) = CompAry(d, 14) + 1
CompAry(d, 15) = CompAry(d, 15) + CDShtAry(f, 11)
CompAry(d, 16) = CompAry(d, 16) + CDShtAry(f, 12)
End If
CompAry(d, 17) = CompAry(d, 17) + CDShtAry(f, 14)
CompAry(d, 18) = 0
End If
Next f
d = d + 1
Next Tech