OptionButton et CheckBox

  • Initiateur de la discussion Mathou
  • Date de début
M

Mathou

Guest
Re bonjour,
Quelqu'un pourrait il m'aider à corriger ce code qui ne fonctionne pas?
Les optionsbuttons et les checkbox sont dans 2 Frames cela a t'il de l'importance?
Merci de votre aide.

Private Sub Tester_Click()
If Cells(1, 1).Value = Célibataire Then
OptionButton1 = True
OptionButton2 = False
OptionButton3 = False
OptionButton4 = False

End If
If Cells(1, 1).Value = Marié Then
OptionButton1 = False
OptionButton2 = True
OptionButton3 = False
OptionButton4 = False

End If
If Cells(1, 1).Value = PACSE Then
OptionButton1 = False
OptionButton2 = False
OptionButton3 = True
OptionButton4 = False

End If
If Cells(1, 1).Value = Divorcé Then
OptionButton1 = False
OptionButton2 = False
OptionButton3 = False
OptionButton4 = True

End If
If Cells(2, 1) = SPP Then
CheckBox1 = True
CheckBox2 = False
CheckBox3 = False
End If
If Cells(2, 1) = SPV Then
CheckBox1 = False
CheckBox2 = True
CheckBox3 = False
End If
If Cells(2, 1) = Stagiaire Then
CheckBox1 = False
CheckBox2 = False
CheckBox3 = True
End If
If Cells(2, 1) = SPP SPV Then
CheckBox1 = True
CheckBox2 = True
CheckBox3 = False
End If
If Cells(2, 1) = SPP Stagiaire Then
CheckBox1 = True
CheckBox2 = False
CheckBox3 = True
End If
If Cells(2, 1) = SPV Stagiaire Then
CheckBox1 = False
CheckBox2 = True
CheckBox3 = True

End If
End Sub
 

pierrejean

XLDnaute Barbatruc
bonjour Mathou

une version qui a l'air de fonctionner

Code:
If Cells(1, 1).Value = 'Célibataire' Then
OptionButton1 = True

End If
If Cells(1, 1).Value = 'Marié' Then
OptionButton2 = True

End If
If Cells(1, 1).Value = 'PACSE' Then
OptionButton3 = True

End If
If Cells(1, 1).Value = 'Divorcé' Then
OptionButton4 = True

End If
If Cells(2, 1) = 'SPP' Then
CheckBox1 = True
CheckBox2 = False
CheckBox3 = False
End If
If Cells(2, 1) = 'SPV' Then
CheckBox1 = False
CheckBox2 = True
CheckBox3 = False
End If
If Cells(2, 1) = 'Stagiaire' Then
CheckBox1 = False
CheckBox2 = False
CheckBox3 = True
End If
If Cells(2, 1) = 'SPP SPV' Then
CheckBox1 = True
CheckBox2 = True
CheckBox3 = False
End If
If Cells(2, 1) = 'SPP Stagiaire' Then
CheckBox1 = True
CheckBox2 = False
CheckBox3 = True
End If
If Cells(2, 1) = 'SPV Stagiaire' Then
CheckBox1 = False
CheckBox2 = True
CheckBox3 = True

End If

tu remarqueras les '' pour le texte en A1 zet A2
pour les optionbutton s'il y a un true les autres sont false automatiquement

Message édité par: pierrejean, à: 21/06/2006 14:46
 
M

Mathou

Guest
Merci vraiment beaucoup pierrejean, cela fonctionne très bien!
Vous ne voudriez pas jeter un coup au fil intitulé, problèmes de fonctionnement d'un userform, car j'ai un problème avec et je ne comprends pas.
Merci pour votre aide
 

Statistiques des forums

Discussions
312 493
Messages
2 088 956
Membres
103 990
dernier inscrit
lamiadebz