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 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
   | Private Sub result_Click()
 
diam12.Text = diam1.Text & " " & class1.Text & " " & qualite1.Text
 
diam13.Value = diam1.Text & " " & class2.Text & " " & qualite2.Text
 
Dim col1, col2, ligne1 As Integer
 
col1 = 2 + Val(qualite1.Text)
col2 = 2 + Val(qualite2.Text)
ligne1 = 5
 
While Val(diam1.Text) < Worksheets("IT").Cells(ligne1, 1) Or Val(diam1.Text) > Worksheets("IT").Cells(ligne1, 2)
ligne1 = ligne1 + 1
Wend
 
IT1.Value = Worksheets("IT").Cells(ligne1, col1)
IT2.Value = Worksheets("IT").Cells(ligne1, col2)
 
'ecarts alesage'
 
Dim EI, ES As Double
Dim col, colq, ligne As Byte
 
'ecart inferieur'
 
col = 3
ligne = 6
 
While Val(diam1.Text) < Worksheets("alesages").Cells(ligne, 1) Or Val(diam1.Text) > Worksheets("alesages").Cells(ligne, 2)
ligne = ligne + 1
Wend
 
While class1.Text <> Worksheets("Alesages").Cells(4, col)
col = col + 1
Wend
 
EI = Worksheets("Alesages").Cells(ligne, col)
 
If col = 14 Then
EI = -(Val(IT1.Text) / 2)
End If
 
'ecart superieur'
 
If Val(qualite1.Text) = 3 Then
colq = 38
End If
 
If Val(qualite1.Text) = 4 Then
colq = 39
End If
 
If Val(qualite1.Text) = 5 Then
colq = 40
End If
 
If Val(qualite1.Text) = 6 Then
colq = 41
End If
 
If Val(qualite1.Text) = 7 Then
colq = 42
End If
 
If Val(qualite1.Text) = 8 Then
colq = 43
End If
 
If col >= 15 Then
 
col = 15
ligne = 6
 
While class1.Text <> Worksheets("alesages").Cells(4, col)
col = col + 1
Wend
 
While Val(diam1.Text) < Worksheets("alesages").Cells(ligne, 1) Or Val(diam1.Text) > Worksheets("alesages").Cells(ligne, 2)
ligne = ligne + 1
Wend
 
If col = 15 Then
col = 15 - 6 + Val(qualite1.Text)
End If
 
ES = Worksheets("Alesages").Cells(ligne, col)
 
If col >= 26 And Val(qualite1.Text) <= 7 Then
ES = (Worksheets("Alesages").Cells(ligne, col) + Worksheets("Alesages").Cells(ligne, colq))
End If
 
EI = ES - Val(IT1.Text)
 
End If
 
ei1.Value = EI
 
'ecarts arbre'
 
Dim ESa, EIa As Double
Dim cola, lignea As Integer
 
'ecart superieur'
 
cola = 3
lignea = 6
 
While class2.Text <> Worksheets("Arbres").Cells(4, cola)
cola = cola + 1
Wend
 
While Val(diam1.Text) < Worksheets("Arbres").Cells(lignea, 1) Or Val(diam1.Text) > Worksheets("arbres").Cells(lignea, 2)
lignea = lignea + 1
Wend
 
ESa = Worksheets("Arbres").Cells(lignea, cola)
 
If cola = 14 Then
ESa = Val(IT2.Text) / 2
End If
 
'ecart inferieur'
 
If cola >= 15 Then
 
cola = 15
lignea = 6
 
While class2.Text <> Worksheets("Arbres").Cells(4, cola)
cola = cola + 1
Wend
 
While Val(diam1.Text) < Worksheets("Arbres").Cells(lignea, 1) Or Val(diam1.Text) > Worksheets("arbres").Cells(lignea, 2)
lignea = lignea + 1
Wend
 
If cola = 15 And Val(qualite2.Text) <> 5 Then
cola = 15 - 6 + Val(qualite2.Text)
End If
 
If cola = 15 And Val(qualite2.Text) = 5 Then
cola = 15
End If
 
If cola = 19 And Val(qualite2.Text) <= 3 Then
cola = cola + 1
End If
 
EIa = Worksheets("Arbres").Cells(lignea, cola)
ESa = EIa + Val(IT2.Text)
 
End If
 
es2.Value = ESa
 
If Val(diam1.Text) > 1 Then
 
ei2.Value = Val(es2.Text) - Val(IT2.Text)
es1.Value = Val(ei1.Text) + Val(IT1.Text)
 
End If
 
jma.Value = (Val(es1.Text) - Val(ei2.Text)) / 1000
jmi.Value = (Val(es2.Text) - Val(ei1.Text)) / 1000
 
End Sub | 
Partager