Combobox

Bruce68

XLDnaute Impliqué
Bonjour à tous
Dans l'initialisation d'une ComboBox est il possible quand celle ci ne comporte qu'un seul nom de ne pas avoir le nom de la colonne.
Si je supprime le nom de la colonne la combobox se met en erreur, obliger d'avoir au minimum 2 valeurs

Je vous remercie de votre aide
 

Pièces jointes

  • Test Combobox.xlsm
    18.3 KB · Affichages: 14

Roland_M

XLDnaute Barbatruc
Re : Combobox

bonjour,

Code:
Private Sub UserForm_Initialize() '  [1] INITIALISE UserModif (Départ)
Dim Plage As Range, NbrDeLig&
NbrDeLig = Range("A" & Rows.Count).End(xlUp).Row - 1
If NbrDeLig > 1 Then
   Set Plage = Range("A2:A" & NbrDeLig + 1)
   ComboBox1.List = Plage.Value
ElseIf NbrDeLig = 1 Then
   ComboBox1.AddItem Range("A2")
End If
End Sub
Private Sub ComboBox1_Change()  '  [2] REMPLI LE FORMULAIRE
Lgn = ComboBox1.ListIndex + 1
Label4 = Cells(Lgn, 2)
Label5 = Cells(Lgn, 3)
End Sub
 

Discussions similaires

Réponses
13
Affichages
413

Statistiques des forums

Discussions
314 207
Messages
2 107 261
Membres
109 790
dernier inscrit
hakim.kerbiche