[Résolu] CheckBox, Bouton et ScrollBar

craig974

XLDnaute Occasionnel
Bonjour,
Ce que je désire faire : après choix sur differentes combobox et après avoir cliqué sur un bouton certaines checkbox doivent "se" cocher. On doit pouvoir continuer a faire des choix sur les differentes combobox et réappuyer sur le bouton, mais si tel ou tel checkbox est deja cochée apparait un message d'erreur.

Mon problème: les combobox sont faites, le bouton aussi, les checkbox et tout ce qui s'en suit aussi, le seul probleme est que le message d'erreur apparait dès le premier choix. Ci-après le morceau de code impliqué :

Code:
If ComboBox3.Value = "1" Or ComboBox5.Value = "1" Or ComboBox7.Value = "1" Or ComboBox9.Value = "1" Then
CheckBox1.Value = True
End If
If ComboBox3.Value = "2" Or ComboBox5.Value = "2" Or ComboBox7.Value = "2" Or ComboBox9.Value = "2" Then
CheckBox2.Value = True
End If
If ComboBox3.Value = "3" Or ComboBox5.Value = "3" Or ComboBox7.Value = "3" Or ComboBox9.Value = "3" Then
CheckBox3.Value = True
End If
If ComboBox3.Value = "4" Or ComboBox5.Value = "4" Or ComboBox7.Value = "4" Or ComboBox9.Value = "4" Then
CheckBox4.Value = True
End If
If ComboBox3.Value = "5" Or ComboBox5.Value = "5" Or ComboBox7.Value = "5" Or ComboBox9.Value = "5" Then
CheckBox5.Value = True
End If
If ComboBox3.Value = "6" Or ComboBox5.Value = "6" Or ComboBox7.Value = "6" Or ComboBox9.Value = "6" Then
CheckBox6.Value = True
End If
If ComboBox3.Value = "7" Or ComboBox5.Value = "7" Or ComboBox7.Value = "7" Or ComboBox9.Value = "7" Then
CheckBox7.Value = True
End If
If ComboBox3.Value = "8" Or ComboBox5.Value = "8" Or ComboBox7.Value = "8" Or ComboBox9.Value = "8" Then
CheckBox8.Value = True
End If

If CheckBox1.Value = True And (ComboBox3.Value = "1" Or ComboBox5.Value = "1" Or ComboBox7.Value = "1" Or ComboBox9.Value = "1") Then
MsgBox "L'adresse 1 est déjà utilisée", vbCritical
End If
If CheckBox2.Value = True And (ComboBox3.Value = "2" Or ComboBox5.Value = "2" Or ComboBox7.Value = "2" Or ComboBox9.Value = "2") Then
MsgBox "L'adresse 2 est déjà utilisée", vbCritical
End If
If CheckBox3.Value = True And (ComboBox3.Value = "3" Or ComboBox5.Value = "3" Or ComboBox7.Value = "3" Or ComboBox9.Value = "3") Then
MsgBox "L'adresse 3 est déjà utilisée", vbCritical
End If
If CheckBox4.Value = True And (ComboBox3.Value = "4" Or ComboBox5.Value = "4" Or ComboBox7.Value = "4" Or ComboBox9.Value = "4") Then
MsgBox "L'adresse 4 est déjà utilisée", vbCritical
End If
If CheckBox5.Value = True And (ComboBox3.Value = "5" Or ComboBox5.Value = "5" Or ComboBox7.Value = "5" Or ComboBox9.Value = "5") Then
MsgBox "L'adresse 5 est déjà utilisée", vbCritical
End If
If CheckBox6.Value = True And (ComboBox3.Value = "6" Or ComboBox5.Value = "6" Or ComboBox7.Value = "6" Or ComboBox9.Value = "6") Then
MsgBox "L'adresse 6 est déjà utilisée", vbCritical
End If
If CheckBox7.Value = True And (ComboBox3.Value = "7" Or ComboBox5.Value = "7" Or ComboBox7.Value = "7" Or ComboBox9.Value = "7") Then
MsgBox "L'adresse 7 est déjà utilisée", vbCritical
End If
If CheckBox8.Value = True And (ComboBox3.Value = "8" Or ComboBox5.Value = "8" Or ComboBox7.Value = "8" Or ComboBox9.Value = "8") Then
MsgBox "L'adresse 8 est déjà utilisée", vbCritical
End If

Et petite question comment peut on fixer la barre de défilement liée a une textbox en effet la mienne apparait que lorsque l'on clique sur la textbox et je voudrais qu'on la voie avant de cliquer dessus

Merci d'avance pour toute aide.
 
Dernière édition:

craig974

XLDnaute Occasionnel
Solution pour que la scrollbar soit affiché sans avoir à cliquer sur la textbox

Voila ce que j'ai pu trouver sur un forum , à ce que tout le monde dit il s'agit de bidouillage (mais bon sa marche). Pour remplir mes textbox je clique sur un bouton et c'est à ce niveau qu'il faut rajouter ceci
Code:
Private Sub CommandButton1_Click()
CommandButton1.SetFocus
TextBox1.SetFocus
TextBox2.SetFocus
TextBox3.SetFocus
Après a modifier suivant le "numero" du bouton et ke nombre de texte box concerné
 

craig974

XLDnaute Occasionnel
Re : [Résolu] CheckBox, Bouton et ScrollBar

Ne t'étonnes pas sa marche pas XD comme tu dis il n'y a que le dernier qui garde la barre, j'avais pas remarqué parcequ'en essayant j'ai mis de tres long texte et au bout d'un moment les barres s'affiche au niveau des trois textbox mais c'est vrai que si le texte est plus long que la textbox de quelque ligne il faut tjrs cliquer sur la textbox pour que la barre s'affiche.
 

Statistiques des forums

Discussions
312 761
Messages
2 091 797
Membres
105 074
dernier inscrit
JPATOUNE