Private Sub OptionButton7_Change()
If OptionButton7 Then
ComboBox4.Enabled = True
TextBox4.Enabled = True
OptionButton9.Enabled = True
OptionButton10.Enabled = True
If OptionButton7 And Not ComboBox4.ListIndex = -1 Then TextBox4 = ComboBox4.Column(1)
Else
ComboBox4.Enabled = 0: ComboBox4.Clear: TextBox4 = ""
End If
End Sub
Bt = Array("Pomme", "Poire", "Cerise" et "Fraise")
For i = 0 To UBound(Bt)
Sheets(1).Shapes(Bt(i)).Select
Selection.Enabled = 0
Next
Martial
Pour l'USF 2, je devrais passer également par un OptionButton5_Change() plutôt qu'un OptionButton5_Click() ?
Idem pour la checkBox 1 ?
Private Sub CheckBox1_Change()
'Si CheckBox1 est vrai
If CheckBox1 = True Then
'alors
TextBox6.Enabled = True
Else
'sinon
CheckBox1 = False: TextBox6 = "": TextBox6.Enabled = False
End If
End Sub
Re,
C'est normal, en remplaçant tes boutons par des images, les objets ne commencent plus par "CommandButton" mais surement par "Picture" ou "Image".
Si tu lances ta macro en pas à pas (avec la touche F8) tu t'aperçois que ça bloque à la ligne Sheets(1).Shapes("CommandButton" & Bt(i)).Select, parce que tu n'as plus d'objet nommé CommandButton22 (pour le premier.
Si tes noms se nomment : Pomme, Poire, Cerise et Fraise, tu peux écrire directement
A+VB:Bt = Array("Pomme", "Poire", "Cerise" et "Fraise") For i = 0 To UBound(Bt) Sheets(1).Shapes(Bt(i)).Select Selection.Enabled = 0 Next
Martial
J'avoue mon ignorance car malgré tes explications je ne comprends pas.
Bt = Array(22, 23, 26, 21)
For i = 0 To UBound(Bt)
Sheets(1).Shapes("CommandButton" & Bt(i)).Select
Selection.Enabled = 0
Next