Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

Evelynetfrancois

XLDnaute Impliqué
Bonjour, à tous
je me permets de vous soumettre mon souci !!

Ranger en ligne sur un USF , j ai mis 5 Checkbox : CheckBox1, CheckBox2, CheckBox3 …………
Je cherche à récupérer une valeur en "Textbox5 « en fonction, du ou des CheckBox(s) cochés

Exemple
CheckBox1 coché ........TextBox5 = 1

If CheckBox1.Value = True Then
TextBox5.Value = "1"
End If

CheckBox2, et CheckBox4 , et CheckBox5 cochés…….. TextBox5 = 245

If CheckBox2 Or CheckBox4 Or CheckBox5 = True Then
TextBox5.Value = "245"
End If


Evidement je ne trouve pas , auriez vous une idée

un grand merci d'avance pour toutes vos sujetions
bonne journée à tous
E et F


If CheckBox1.Value = True Then
TextBox5.Value = "1"
End If
If CheckBox2.Value = True Then
TextBox5.Value = "2"
End If
If CheckBox3.Value = True Then
TextBox5.Value = "3"
End If
If CheckBox4.Value = True Then
TextBox5.Value = "4"
End If
If CheckBox5.Value = True Then
TextBox5.Value = "5"
End If
If CheckBox2 Or CheckBox3 = True Then
TextBox5.Value = "23"
End If
If CheckBox2 Or CheckBox4 = True Then
TextBox5.Value = "24"
End If
If CheckBox2 Or CheckBox5 = True Then
TextBox5.Value = "25"
End If
If CheckBox3 Or CheckBox4 = True Then
TextBox5.Value = "34"
End If
If CheckBox3 Or CheckBox5 = True Then
TextBox5.Value = "35"
End If
If CheckBox4 Or CheckBox5 = True Then
TextBox5.Value = "45"
End If
If CheckBox1 Or CheckBox2 Or CheckBox3 = True Then
TextBox5.Value = "123"
End If
If CheckBox1 Or CheckBox2 Or CheckBox4 = True Then
TextBox5.Value = "124"
End If
If CheckBox1 Or CheckBox2 Or CheckBox5 = True Then
TextBox5.Value = "125"
End If
If CheckBox1 Or CheckBox3 Or CheckBox4 = True Then
TextBox5.Value = "134"
End If
If CheckBox1 Or CheckBox3 Or CheckBox5 = True Then
TextBox5.Value = "135"
End If
If CheckBox1 Or CheckBox4 Or CheckBox5 = True Then
TextBox5.Value = "145"
End If
If CheckBox2 Or CheckBox3 Or CheckBox4 = True Then
TextBox5.Value = "234"
End If
If CheckBox2 Or CheckBox3 Or CheckBox5 = True Then
TextBox5.Value = "235"
End If
If CheckBox2 Or CheckBox4 Or CheckBox5 = True Then
TextBox5.Value = "245"
End If
If CheckBox3 Or CheckBox4 Or CheckBox5 = True Then
TextBox5.Value = "345"
End If
If CheckBox1 Or CheckBox2 Or CheckBox3 Or CheckBox4 = True Then
TextBox5.Value = "1234"
End If
If CheckBox1 Or CheckBox2 Or CheckBox3 Or CheckBox5 = True Then
TextBox5.Value = "1235"
End If
If CheckBox1 Or CheckBox2 Or CheckBox4 Or CheckBox5 = True Then
TextBox5.Value = "1245"
End If
If CheckBox1 Or CheckBox3 Or CheckBox4 Or CheckBox5 = True Then
TextBox5.Value = "1345"
End If
If CheckBox2 Or CheckBox3 Or CheckBox4 Or CheckBox5 = True Then
TextBox5.Value = "2345"
End If
If CheckBox1 Or CheckBox2 Or CheckBox3 Or CheckBox4 Or CheckBox5 = True Then
TextBox5.Value = "12345"
End If
 
Re : checkbox (s)

Bonjour Evelynetfrancois, Jean-Pierre🙂

Si j'ai bien compris, peut être comme ceci

Code:
Dim c As Control
For Each c In Me.Controls
    If TypeName(c) = "CheckBox" Then
        If c.Value = True Then TextBox1.Value = TextBox1.Value & Right(c.Name, 1)
    End If
Next c

bonne journée
@+
 
Re : checkbox (s)

Bonjour jeanpierre, Pierrot93, carcharodon-carcharias

Merci à vous trois pour votre rapidité !!!
La proposition de pierrot93 me convient PARFAITEMENT !!! Merci beaucoup !!!
Effectivement carcharodon-carcharias ,5423 n’est pas possibles, mais je n’en veux pas lol

Merci à vous et bonne journée …au plaisir de vous lire .......
E et F
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

Réponses
13
Affichages
580
Réponses
18
Affichages
815
Réponses
3
Affichages
899
Réponses
3
Affichages
797
Réponses
2
Affichages
550
Retour