I have a for next loop that is supposed to go from 1 to 4 but stops at 1.5. If anyone can see anything wrong I would appreciate hearing about it.
Dim varOne(4) As Single
Static A(4, 8) As Double
Dim Total As Double
Static varTwo(4, 8) As Double
Dim Max As Double
For D = 1 To 4 Step 1
A(D, D) = varOne(D) * varTwo(D, D) * varThree
A(D, D + 1) =varOne(D+1)*varTwo(D,D+1)*varThree
A(D, D + 2) =varOne(D+2)*varTwo(D,D+2)*varThree
A(D, D + 3) =varOne(D+3)*varTwo(D,D+3)*varThree
Total = A(D, D)+A(D,D+1)+A(D,D+2)+A(D,D+3)
If Total >= Max Then
Max = Total
End If
Next D
Dim varOne(4) As Single
Static A(4, 8) As Double
Dim Total As Double
Static varTwo(4, 8) As Double
Dim Max As Double
For D = 1 To 4 Step 1
A(D, D) = varOne(D) * varTwo(D, D) * varThree
A(D, D + 1) =varOne(D+1)*varTwo(D,D+1)*varThree
A(D, D + 2) =varOne(D+2)*varTwo(D,D+2)*varThree
A(D, D + 3) =varOne(D+3)*varTwo(D,D+3)*varThree
Total = A(D, D)+A(D,D+1)+A(D,D+2)+A(D,D+3)
If Total >= Max Then
Max = Total
End If
Next D