Menu déroulant variable par macro dans un option button

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 !

lepigoennier

XLDnaute Junior
Bonjour à tous,

J'ai un document de de soumission où je dois choisir (par optionbutton) un des 3 entrepôts. Lorsque l'entrepôt est choisi, mes combobox se remplissent avec les fournisseurs de cet entrepôt. Mon problème est que la liste de fournisseur peut s'allonger mais que mes combobox ne se mettent pas à jour. Comment puis-je faire la mise à jour automatique sans aller dans le code? Voici mon code pour 1 des 3 optionbutton.

Code:
Private Sub OptionButton3_Click() 
        With ComboBox1
        .Text = ""
        
        .ListFillRange = "'Menus déroulants'!G3:G333"
        .LinkedCell = "$C$24"
    End With
    
    With ComboBox4
        .Text = ""
        .ListFillRange = "'Menus déroulants'!G3:G333"
        .LinkedCell = "$C$25"
    End With
    
    With ComboBox2
        .Text = ""
        .ListFillRange = "'Menus déroulants'!G3:G333"
        .LinkedCell = "$C$26"
    End With
    
    With ComboBox5
        .Text = ""
        .ListFillRange = "'Menus déroulants'!G3:G333"
        .LinkedCell = "$C$27"
    End With
    
    With ComboBox6
        .Text = ""
        .ListFillRange = "'Menus déroulants'!G3:G333"
        .LinkedCell = "$C$28"
    End With
    
    With ComboBox3
        .ListFillRange = "'Menus déroulants'!B3:B17"
        .LinkedCell = "$B$6"
    End With
    
    Call Macro3
End Sub

De plus lorsque je choisi un fournisseur, son courriel son adresse et son # apparait dans 3 cellules différentes dont voici le code

Code:
Private Sub ComboBox1_Change()
    
    If OptionButton3.Value = True Then
        Range("F24").Select
        ActiveCell.FormulaR1C1 = _
        "=IF(OR(ISNA(RC[-3]),ISBLANK(RC[-3]))=TRUE,"""",VLOOKUP(RC[-3],'Menus déroulants'!C[1]:C[4],2,FALSE))"
        Range("H24").Select
        ActiveCell.FormulaR1C1 = _
        "=IF(OR(ISNA(RC[-5]),ISBLANK(RC[-5]))=TRUE,"""",VLOOKUP(RC[-5],'Menus déroulants'!C[-1]:C[2],3,FALSE))"
        Range("J24").Select
        ActiveCell.FormulaR1C1 = _
        "=IF(OR(ISNA(RC[-7]),ISBLANK(RC[-7]))=TRUE,"""",VLOOKUP(RC[-7],'Menus déroulants'!C[-3]:C,4,FALSE))"
        Range("A27").Select
                
        Else
    If OptionButton2.Value = True Then
        Range("F24").Select
        ActiveCell.FormulaR1C1 = _
        "=IF(OR(ISNA(RC[-3]),ISBLANK(RC[-3]))=TRUE,"""",VLOOKUP(RC[-3],'Menus déroulants'!C[11]:C[14],2,FALSE))"
        Range("H24").Select
        ActiveCell.FormulaR1C1 = _
        "=IF(OR(ISNA(RC[-5]),ISBLANK(RC[-5]))=TRUE,"""",VLOOKUP(RC[-5],'Menus déroulants'!C[9]:C[12],3,FALSE))"
        Range("J24").Select
        ActiveCell.FormulaR1C1 = _
        "=IF(OR(ISNA(RC[-7]),ISBLANK(RC[-7]))=TRUE,"""",VLOOKUP(RC[-7],'Menus déroulants'!C[7]:C[10],4,FALSE))"
        Range("A27").Select
        
    Else
    If OptionButton1.Value = True Then
        Range("F24").Select
        ActiveCell.FormulaR1C1 = _
        "=IF(OR(ISNA(RC[-3]),ISBLANK(RC[-3]))=TRUE,"""",VLOOKUP(RC[-3],'Menus déroulants'!C[6]:C[9],2,FALSE))"
        Range("H24").Select
        ActiveCell.FormulaR1C1 = _
        "=IF(OR(ISNA(RC[-5]),ISBLANK(RC[-5]))=TRUE,"""",VLOOKUP(RC[-5],'Menus déroulants'!C[4]:C[7],3,FALSE))"
        Range("J24").Select
        ActiveCell.FormulaR1C1 = _
        "=IF(OR(ISNA(RC[-7]),ISBLANK(RC[-7]))=TRUE,"""",VLOOKUP(RC[-7],'Menus déroulants'!C[2]:C[5],4,FALSE))"
        Range("A27").Select
        
        
        
        
    Else
    End If
    End If
    End If
    
End Sub

Merci de m'aider à résoudre ce casse-tête
 
- 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
7
Affichages
84
Réponses
11
Affichages
721
Réponses
17
Affichages
900
Réponses
2
Affichages
421
  • Question Question
Microsoft 365 VBA sur outlook
Réponses
14
Affichages
964
  • Question Question
Microsoft 365 Export données
Réponses
4
Affichages
497
Retour