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 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
| Private Sub ListBox1_Change()
If ListBox1.Selected(0) = False Then
ComboBox5.Visible = False
ComboBox5.Enabled = False
With Worksheets("Feuil1")
.Cells.Locked = False
.Range("G5,J5") = ""
.Range("G5,J5").Locked = True
.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End With
Else
ComboBox5.Visible = True
ComboBox5.Enabled = True
Worksheets("Feuil1").Range("G5").Locked = False
End If
If ListBox1.Selected(1) = False Then
ComboBox5.Visible = False
ComboBox5.Enabled = False
With Worksheets("Feuil1")
.Cells.Locked = False
.Range("G6,J6") = ""
.Range("G6,J6").Locked = True
.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End With
Else
ComboBox6.Visible = True
ComboBox6.Enabled = True
Worksheets("Feuil1").Range("G6").Locked = False
End If
If ListBox1.Selected(2) = False Then
ComboBox7.Visible = False
ComboBox7.Enabled = False
With Worksheets("Feuil1")
.Cells.Locked = False
.Range("G7,J7") = ""
.Range("G7,J7").Locked = True
.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End With
Else
ComboBox7.Visible = True
ComboBox7.Enabled = True
Worksheets("Feuil1").Range("G7").Locked = False
End If
If ListBox1.Selected(3) = False Then
ComboBox8.Visible = False
ComboBox8.Enabled = False
With Worksheets("Feuil1")
.Cells.Locked = False
.Range("G8,J8") = ""
.Range("G8,J8").Locked = True
.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End With
Else
ComboBox8.Visible = True
ComboBox8.Enabled = True
Worksheets("Feuil1").Range("G8").Locked = False
End If
If ListBox1.Selected(4) = False Then
ComboBox9.Visible = False
ComboBox9.Enabled = False
With Worksheets("Feuil1")
.Cells.Locked = False
.Range("G9,J9") = ""
.Range("G9,J9").Locked = True
.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End With
Else
ComboBox9.Visible = True
ComboBox9.Enabled = True
Worksheets("Feuil1").Range("G9").Locked = False
End If
If ListBox1.Selected(5) = False Then
ComboBox10.Visible = False
ComboBox10.Enabled = False
With Worksheets("Feuil1")
.Cells.Locked = False
.Range("G10,J10") = ""
.Range("G10,J10").Locked = True
.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End With
Else
ComboBox10.Visible = True
ComboBox10.Enabled = True
Worksheets("Feuil1").Range("G10").Locked = False
End If
If ListBox1.Selected(6) = False Then
ComboBox11.Visible = False
ComboBox11.Enabled = False
With Worksheets("Feuil1")
.Cells.Locked = False
.Range("G11,J11") = ""
.Range("G11,J11").Locked = True
.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End With
Else
ComboBox11.Visible = True
ComboBox11.Enabled = True
Worksheets("Feuil1").Range("G11").Locked = False
End If
If ListBox1.Selected(7) = False Then
ComboBox12.Visible = False
ComboBox12.Enabled = False
With Worksheets("Feuil1")
.Cells.Locked = False
.Range("G12,J12") = ""
.Range("G12,J12").Locked = True
.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End With
Else
ComboBox12.Visible = True
ComboBox12.Enabled = True
Worksheets("Feuil1").Range("G12").Locked = False
End If
If ListBox1.Selected(8) = False Then
ComboBox13.Visible = False
ComboBox13.Enabled = False
With Worksheets("Feuil1")
.Cells.Locked = False
.Range("G13,J13") = ""
.Range("G13,J13").Locked = True
.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End With
Else
ComboBox13.Visible = True
ComboBox13.Enabled = True
Worksheets("Feuil1").Range("G15").Locked = False
End If
If ListBox1.Selected(9) = False Then
ComboBox14.Visible = False
ComboBox14.Enabled = False
With Worksheets("Feuil1")
.Cells.Locked = False
.Range("G14,J14") = ""
.Range("G14,J14").Locked = True
.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End With
Else
ComboBox14.Visible = True
ComboBox14.Enabled = True
Worksheets("Feuil1").Range("G14").Locked = False
End If
If ListBox1.Selected(10) = False Then
ComboBox15.Visible = False
ComboBox15.Enabled = False
With Worksheets("Feuil1")
.Cells.Locked = False
.Range("G15,J15") = ""
.Range("G15,J15").Locked = True
.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End With
Else
ComboBox15.Visible = True
ComboBox15.Enabled = True
Worksheets("Feuil1").Range("G15").Locked = False
End If
If ListBox1.Selected(11) = False Then
ComboBox16.Visible = False
ComboBox16.Enabled = False
With Worksheets("Feuil1")
.Cells.Locked = False
.Range("G16,J16") = ""
.Range("G16,J16").Locked = True
.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End With
Else
ComboBox16.Visible = True
ComboBox16.Enabled = True
Worksheets("Feuil1").Range("G16").Locked = False
End If
End Sub |
Partager