Données sur feuilles excel
Ludo1970
Messages postés
2
Statut
Membre
-
yg_be Messages postés 24281 Date d'inscription Statut Contributeur Dernière intervention -
yg_be Messages postés 24281 Date d'inscription Statut Contributeur Dernière intervention -
Bonjour,
Est-t'il possible de reprendre une zone de cellule pour faire un bout de code plus court que:
If ComboBox1.Value = "214510100" Then UserForm2.Show
If ComboBox1.Value = "214510150" Then UserForm2.Show
If ComboBox1.Value = "214510200" Then UserForm2.Show
If ComboBox1.Value = "214510300" Then UserForm2.Show
If ComboBox1.Value = "214510400" Then UserForm2.Show
*
If ComboBox1.Value = "214510500" Then UserForm3.Show
If ComboBox1.Value = "214510600" Then UserForm3.Show
If ComboBox1.Value = "214510800" Then UserForm3.Show
If ComboBox1.Value = "214520010" Then UserForm3.Show
*
If ComboBox1.Value = "274510100" Then UserForm4.Show
If ComboBox1.Value = "274510150" Then UserForm4.Show
If ComboBox1.Value = "274510200" Then UserForm4.Show
If ComboBox1.Value = "274510300" Then UserForm4.Show
*
If ComboBox1.Value = "223520015" Then UserForm5.Show
If ComboBox1.Value = "223520016" Then UserForm5.Show
If ComboBox1.Value = "223520018" Then UserForm5.Show
If ComboBox1.Value = "223520020" Then UserForm5.Show
If ComboBox1.Value = "223520025" Then UserForm5.Show
Ce qui fait que selon le résultat de la comboBox1 c'est un UserForm qui s’ouvre.
En gros, je veux écrire sur une feuille excel les données 214510100; 214510200; 214510300 etc...
En gros un code dans ce genre:
If ComboBox1.Value ("A1:A6") Then Userform1.Show
If ComboBox1.Value ("A7:A10") Then Userform2.Show
If ComboBox1.Value ("A11:A14") Then Userform3.Show
D'avance MERCI
Est-t'il possible de reprendre une zone de cellule pour faire un bout de code plus court que:
If ComboBox1.Value = "214510100" Then UserForm2.Show
If ComboBox1.Value = "214510150" Then UserForm2.Show
If ComboBox1.Value = "214510200" Then UserForm2.Show
If ComboBox1.Value = "214510300" Then UserForm2.Show
If ComboBox1.Value = "214510400" Then UserForm2.Show
*
If ComboBox1.Value = "214510500" Then UserForm3.Show
If ComboBox1.Value = "214510600" Then UserForm3.Show
If ComboBox1.Value = "214510800" Then UserForm3.Show
If ComboBox1.Value = "214520010" Then UserForm3.Show
*
If ComboBox1.Value = "274510100" Then UserForm4.Show
If ComboBox1.Value = "274510150" Then UserForm4.Show
If ComboBox1.Value = "274510200" Then UserForm4.Show
If ComboBox1.Value = "274510300" Then UserForm4.Show
*
If ComboBox1.Value = "223520015" Then UserForm5.Show
If ComboBox1.Value = "223520016" Then UserForm5.Show
If ComboBox1.Value = "223520018" Then UserForm5.Show
If ComboBox1.Value = "223520020" Then UserForm5.Show
If ComboBox1.Value = "223520025" Then UserForm5.Show
Ce qui fait que selon le résultat de la comboBox1 c'est un UserForm qui s’ouvre.
En gros, je veux écrire sur une feuille excel les données 214510100; 214510200; 214510300 etc...
En gros un code dans ce genre:
If ComboBox1.Value ("A1:A6") Then Userform1.Show
If ComboBox1.Value ("A7:A10") Then Userform2.Show
If ComboBox1.Value ("A11:A14") Then Userform3.Show
D'avance MERCI
A voir également:
- Données sur feuilles excel
- Liste déroulante excel - Guide
- Trier des données excel - Guide
- Comment faire un livret avec des feuilles a4 - Guide
- Word et excel gratuit - Guide
- Comment calculer la moyenne sur excel - Guide
3 réponses
Bonjour,
Exemples:
1- Avec les valeurs:
2- Avec les cellules
Cdlt
Exemples:
1- Avec les valeurs:
Select Case ComboBox1.Text
Case Is = "214510100", "214510150", "214510200", "214510300", "214510400"
UserForm2.Show
Case Is = "214510500", "214510600", "214510800", "214520010"
UserForm3.Show
Case Is = "274510100", "274510150", "274510200", "274510300"
UserForm4.Show
Case Is = "223520015", "223520016", "223520018", "223520020", "223520025"
UserForm5.Show
End Select
2- Avec les cellules
Select Case ComboBox1
Case Is = CStr([A1]), CStr([A2]), CStr([A3]), CStr([A4]), [A5], CStr([A6])
UserForm1.Show
Case Is = CStr([A7]), CStr([A8]), CStr([A9]), CStr([A10])
UserForm2.Show
Case Is = CStr([A11]), CStr([A12]), CStr([A13]), CStr([A14])
UserForm3.Show
End Select
Cdlt
Salut Frenchie83,
Merci pour ta réponse. Donc si je comprends bien, pas moyen de sélectionner une plage de cellule, voir une plage de cellule nommée.
Merci pour ta réponse. Donc si je comprends bien, pas moyen de sélectionner une plage de cellule, voir une plage de cellule nommée.
yg_be
Messages postés
24281
Date d'inscription
Statut
Contributeur
Dernière intervention
Ambassadeur
1 585
bonjour, suggestion:
If Not IsError(Application.Match(ComboBox1.Value, [A1:A6], 0)) Then
Userform1.Show
ElseIf Not IsError(Application.Match(ComboBox1.Value, [A7:A10], 0)) Then
Userform2.Show
ElseIf Not IsError(Application.Match(ComboBox1.Value, [A11:A14], 0)) Then
Userform3.Show
End If