maval
XLDnaute Barbatruc
Bonsoir,
J’aimerai simplifier mon code
Un fichier valant mieux qu'un long discours, veuillez voir la pièce jointe.
Par avance merci pour votre aide.
Cordialement
Maval
J’aimerai simplifier mon code
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
For n = 3 To 50
'Point normal
If Cells(n, 4) < 162 And Cells(n, 4) > 0 Then
If Cells(n, 4) <> 81 And Cells(n, 4) <> 91 And Cells(n, 4) <> 71 Then
If Cells(n, 5) = 1 Then
If 162 - Cells(n, 4) = Cells(n, 8) Then
Cells(n, 8) = 162 - Cells(n, 4)
Cells(n, 4) = Cells(n, 4) + 20
End If
Else
Cells(n, 8) = 162 - Cells(n, 4)
End If
End If
End If
If Cells(n, 8) < 162 And Cells(n, 8) > 0 Then
If Cells(n, 8) <> 81 And Cells(n, 8) <> 91 And Cells(n, 8) <> 71 Then
If Cells(n, 9) = 1 Then
If 162 - Cells(n, 8) = Cells(n, 4) Then
Cells(n, 4) = 162 - Cells(n, 8)
Cells(n, 8) = Cells(n, 8) + 20
End If
ElseIf Cells(n, 9) = 0 And Cells(n, 5) = 0 Then
Cells(n, 4) = 162 - Cells(n, 8)
End If
End If
End If
If [H4] = 81 And [L1] <> 1 Then
[H4] = 0
[D4] = 81
[A1] = 81
[L1] = 1
ElseIf [D4] = 81 And [L1] <> 1 Then
[D4] = 0
[H4] = 81
[A1] = 81
[L1] = 1
End If
If [A1] = 81 And [D5] <> 0 And [H5] <> 0 Then
If [D5] < [H5] Then
[H5] = [H5] + [A1]
[A1] = 0
ElseIf [D5] > [H5] Then
[D5] = [D5] + [A1]
[A1] = 0
End If
End If
If [H5] = 81 And [L2] <> 1 Then
[H5] = 0
[D5] = 81
[A1] = 81
[L2] = 1
ElseIf [D5] = 81 And [L2] <> 1 Then
[D5] = 0
[H5] = 81
[A1] = 81
[L2] = 1
End If
If [A1] = 81 And [D6] <> 0 And [H6] <> 0 Then
If [D6] < [H6] Then
[H6] = [H6] + [A1]
[A1] = 0
ElseIf [D6] > [H6] Then
[D6] = [D6] + [A1]
[A1] = 0
End If
End If
Next
Un fichier valant mieux qu'un long discours, veuillez voir la pièce jointe.
Par avance merci pour votre aide.
Cordialement
Maval