Bonjour tout le monde,

J'ai dans un userform plusieurs case à cocher et en fonction de ça, une valeur est renvoyée dans telle ou telle cellule d'un tableau. Or il ne marque procédure trop longue.
Comme puis je simplifier tout ça. voici une partie du code
merci de votre aide
Cordialement

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
Private Sub CommandButton2_Click()
 
'chaine A
        'Dépal
            '6h 13h
If OptionButton108 And OptionButton154 And OptionButton158 And CheckBox1 = True Then
Range("c6:d6").MergeCells = False ' Ne plus fusionner
Sheets("Feuil1").Range("c6") = TextBox1.Value
End If
If OptionButton108 And OptionButton154 And OptionButton158 And CheckBox2 = True Then
Range("e6:f6").MergeCells = False ' Ne plus fusionner
Sheets("Feuil1").Range("E6") = TextBox1.Value
End If
If OptionButton108 And OptionButton154 And OptionButton158 And CheckBox3 = True Then
Range("g6:h6").MergeCells = False ' Ne plus fusionner
Sheets("Feuil1").Range("G6") = TextBox1.Value
End If
If OptionButton108 And OptionButton154 And OptionButton158 And CheckBox4 = True Then
Range("i6:j6").MergeCells = False ' Ne plus fusionner
Sheets("Feuil1").Range("I6") = TextBox1.Value
End If
If OptionButton108 And OptionButton154 And OptionButton158 And CheckBox5 = True Then
Range("k6:l6").MergeCells = False ' Ne plus fusionner
Sheets("Feuil1").Range("K6") = TextBox1.Value
End If
        'Dépal
            '13h 20h
If OptionButton109 And OptionButton154 And OptionButton158 And CheckBox1 = True Then
Range("c6:d6").MergeCells = False ' Ne plus fusionner
Sheets("Feuil1").Range("d6") = TextBox1.Value
End If
If OptionButton109 And OptionButton154 And OptionButton158 And CheckBox2 = True Then
Range("e6:f6").MergeCells = False ' Ne plus fusionner
Sheets("Feuil1").Range("f6") = TextBox1.Value
End If
If OptionButton109 And OptionButton154 And OptionButton158 And CheckBox3 = True Then
Range("g6:h6").MergeCells = False ' Ne plus fusionner
Sheets("Feuil1").Range("h6") = TextBox1.Value
End If
If OptionButton109 And OptionButton154 And OptionButton158 And CheckBox4 = True Then
Range("i6:j6").MergeCells = False ' Ne plus fusionner
Sheets("Feuil1").Range("j6") = TextBox1.Value
End If
If OptionButton109 And OptionButton154 And OptionButton158 And CheckBox5 = True Then
Range("k6:l6").MergeCells = False ' Ne plus fusionner
Sheets("Feuil1").Range("l6") = TextBox1.Value
End If
        'Dépal
            'journée
If OptionButton123 And OptionButton154 And OptionButton158 And CheckBox1 = True Then
Range("c6:d6").MergeCells = True ' Fusionner des cellules
Range("c6").HorizontalAlignment = xlCenter
Sheets("Feuil1").Range("c6") = TextBox1.Value
End If
If OptionButton123 And OptionButton154 And OptionButton158 And CheckBox2 = True Then
Range("e6:f6").MergeCells = True ' Fusionner des cellules
Range("e6").HorizontalAlignment = xlCenter
Sheets("Feuil1").Range("E6") = TextBox1.Value
End If
If OptionButton123 And OptionButton154 And OptionButton158 And CheckBox3 = True Then
Range("g6:h6").MergeCells = True ' Fusionner des cellules
Range("g6").HorizontalAlignment = xlCenter
Sheets("Feuil1").Range("g6") = TextBox1.Value
End If
If OptionButton123 And OptionButton154 And OptionButton158 And CheckBox4 = True Then
Range("i6:j6").MergeCells = True ' Fusionner des cellules
Range("i6").HorizontalAlignment = xlCenter
Sheets("Feuil1").Range("i6") = TextBox1.Value
End If
If OptionButton123 And OptionButton154 And OptionButton158 And CheckBox5 = True Then
Range("k6:l6").MergeCells = True ' Fusionner des cellules
Range("k6").HorizontalAlignment = xlCenter
Sheets("Feuil1").Range("k6") = TextBox1.Value
End If