Combobox dans un user form

Bonjour,

J'ai crée une combobox dans un userform avec des textbox que je rempli au fur et a mesure, mais quand j'arrive a ma combobox je n'arrive pas a l'alimenter avec ma liste!

quelqu'un peut il m'aider ? ci joint mes essais de code

Private Sub ComboBox1_Change()
Set ws = Sheets("REGLEMENT")
With Me.ComboBox1
For j = 3 To ws.Range("I" & Rows.Count).End(x1up).Row
.AddItem ws.Range("I" & j)
Next j
Me.ComboBox1.RowSource = "REGLEMENT!I3;I8"
End With
End Sub

End Sub

'Private Sub combobox1_initialize()
'Set ws = Sheets("REGLEMENT")
'With Me.ComboBox1
'For j = 3 To ws.Range("I" & Rows.Count).End(x1up).Row
'.AddItem ws.Range("I" & j)
'Next j
'Me.ComboBox1.RowSource = "REGLEMENT!I3;I8"
'End With
'End Sub

Merci d'avance

Bonjour

A tester si cela convient passez le sujet en résolu

Crdlt

Private Sub UserForm_Initialize()
    Dim ws As Worksheet
    Dim j As Long

    Set ws = Sheets("REGLEMENT")
    With Me.ComboBox1
        .Clear ' Efface les anciens éléments, si nécessaire
        For j = 3 To ws.Range("I" & Rows.Count).End(xlUp).Row
            .AddItem ws.Range("I" & j).Value
        Next j
    End With
End Sub

Bonjour,

Merci de ta réponse......cela fonctionne et j'ai compris mon erreur.

une petite question, j'ai 3 combobox de suite dans le formulaire ! comment je recupere les réponses pour les copiers dans un tableau.

Private Sub UserForm_Initialize()
Dim ws As Worksheet
Dim j As Long

Set ws = Sheets("REGLEMENT")
With Me.ComboBox1
.Clear ' Efface les anciens éléments, si nécessaire
For j = 3 To ws.Range("I" & Rows.Count).End(xlUp).Row
.AddItem ws.Range("I" & j).Value
Next j
End With
With Me.ComboBox2
.Clear ' Efface les anciens éléments, si nécessaire
For j = 3 To ws.Range("I" & Rows.Count).End(xlUp).Row
.AddItem ws.Range("I" & j).Value
Next j

End with

With Me.ComboBox3
.Clear ' Efface les anciens éléments, si nécessaire
For j = 3 To ws.Range("I" & Rows.Count).End(xlUp).Row
.AddItem ws.Range("I" & j).Value
Next j
End With

End Sub

merci d'avance

A tester

Private Sub CommandButton1_Click()
    Dim ws As Worksheet
    Dim nextRow As Long

    ' Définir la feuille de destination (où vous souhaitez copier les données)
    Set ws = Sheets("Données") ' Changez "Données" par le nom de votre feuille de destination

    ' Trouver la prochaine ligne vide dans la feuille de destination
    nextRow = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row + 1

    ' Copier les valeurs des ComboBox dans le tableau
    ws.Cells(nextRow, 1).Value = Me.ComboBox1.Value ' Colonne A
    ws.Cells(nextRow, 2).Value = Me.ComboBox2.Value ' Colonne B
    ws.Cells(nextRow, 3).Value = Me.ComboBox3.Value ' Colonne C
End Sub

merci....j'ai reussi a avancer avec ta solution

mais j'ai un nvx problemes qui est apparu!!!

erreur systeme

&H80004005-52147467259 erreur non spécifiée et apres Memoire insuffisante

je ne peux plus enregistrer ou lancer les macros ?

merci de ton aide si tu peux

Rechercher des sujets similaires à "combobox user form"