1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
Sub viaHaut()
Dim ZA As Double
Dim ZB As Double
Dim ZC As Double
j = Cells(Columns(1).Cells.Count, 1).End(xlUp).Row
For a = j To 1 Step -1
If a <> 1 Then
If (Cells(a, 1) <> Cells(a + 1, 1)) Then
FUT = Left(Cells(a, 1), 2)
If FUT = "VG" Then
X = Right(Cells(a, 1), 2)
Y = Right(Cells(a + 1, 1), 2)
ElseIf FUT = "Z " Then
X = Right(Cells(a, 1), 2)
Y = Right(Cells(a + 1, 1), 2)
ElseIf FUT = "GX" Then
X = Right(Cells(a, 1), 2)
Y = Right(Cells(a + 1, 1), 2)
ElseIf FUT = "EO" Then
X = Right(Cells(a, 1), 2)
Y = Right(Cells(a + 1, 1), 2)
ElseIf FUT = "CF" Then
X = Right(Cells(a, 1), 2)
Y = Right(Cells(a + 1, 1), 2)
ElseIf FUT = "CM" Then
X = Right(Cells(a, 1), 2)
Y = Right(Cells(a + 1, 1), 2)
ElseIf FUT = "SM" Then
X = Right(Cells(a, 1), 2)
Y = Right(Cells(a + 1, 1), 2)
End If
If (Cells(a, 5) <> Cells(a + 1, 5)) Then
If ((Cells(a, 5) = Cells(a + 1, 5) + Cells(a + 2, 5)) And (Cells(a + 1, 1) = Cells(a + 2, 1))) Then
ZA = Cells(a + 1, 5) * Cells(a + 1, 4) + Cells(a + 2, 5) * Cells(a + 1, 4)
ZB = Cells(a + 1, 5) + Cells(a + 2, 5)
ZC = Round(ZA / ZB, 4)
Cells(a, 9) = ZC
Cells(a, 8) = Cells(a, 5)
If X < Y Then
Cells(a, 10) = Cells(a, 4) - Cells(a, 9)
ElseIf X > Y Then
Cells(a, 10) = Cells(a, 9) - Cells(a, 4)
End If
End If
End If
End If
End If
Next
End Sub |
Partager