Menu déroulant variable par macro dans un option button

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
 

Discussions similaires

Réponses
11
Affichages
418
Réponses
14
Affichages
637

Membres actuellement en ligne

Statistiques des forums

Discussions
312 069
Messages
2 085 041
Membres
102 764
dernier inscrit
nestu