IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Macros et VBA Excel Discussion :

Remplir un comboBox1n d'un Userfom10 a partir d'un ComboBox1trois d'un UserForm3.


Sujet :

Macros et VBA Excel

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Nouveau candidat au Club
    Homme Profil pro
    boite
    Inscrit en
    Mars 2013
    Messages
    1
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Sénégal

    Informations professionnelles :
    Activité : boite
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Mars 2013
    Messages : 1
    Par défaut Remplir un comboBox1n d'un Userfom10 a partir d'un ComboBox1trois d'un UserForm3.
    Bonjour,

    Je voudrais que vous m'aider sur un problème de VBA Excel

    Je veux remplir automatiquement le comboBox1n qui se trouve sur mon UserForm10 via le ComboBox1trois trouvant sur mon UserForm3.

    Voici le code ci-dessous:




    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    Private Sub ComboBox5deux_Change()
     
    End Sub
     
    '********************************************************************************************************************
    'PROCEDURE PERMETTANT D'ACTVER/DESACTIVER LE CheckBox1deux ET DE REMPLIR LE ComboBox1trois A L'AIDE DU CheckBox1deux
    '********************************************************************************************************************
     
    Private Sub CheckBox1deux_Click()
     
    If CheckBox1deux.Value = True Then 'Si CheckBox1deux = Vrai
    ComboBox1trois.AddItem CheckBox1deux.Caption 'Mettez la valeur du CheckBox1deux dans le ComboBox1trois
     
    Else 'Sinon
    ComboBox1trois.Clear 'Supprimer la valeur du ComboBox1trois
    CheckBox1deux.Value = False 'CheckBox1deux = Faux
    CheckBox2deux.Value = False
    CheckBox3deux.Value = False
    CheckBox4deux.Value = False
    End If
    End Sub
     
    '********************************************************************************************************************
    'PROCEDURE PERMETTANT D'ACTVER/DESACTIVER LE CheckBox2deux ET DE REMPLIR LE ComboBox1trois A L'AIDE DU CheckBox2deux
    '********************************************************************************************************************
     
    Private Sub CheckBox2deux_Click()
    If CheckBox2deux.Value = True Then
    ComboBox1trois.AddItem CheckBox2deux.Caption
    Else
    ComboBox1trois.Clear
    CheckBox1deux.Value = False
    CheckBox2deux.Value = False
    CheckBox3deux.Value = False
    CheckBox4deux.Value = False
    End If
    End Sub
     
    Private Sub CheckBox3deux_Click()
    If CheckBox3deux.Value = True Then
    ComboBox1trois.AddItem CheckBox3deux.Caption
    Else
    ComboBox1trois.Clear
    CheckBox1deux.Value = False
    CheckBox2deux.Value = False
    CheckBox3deux.Value = False
    CheckBox4deux.Value = False
    End If
    End Sub
     
    Private Sub CheckBox4deux_Click()
    If CheckBox4deux.Value = True Then
    ComboBox1trois.AddItem CheckBox4deux.Caption
    Else
    ComboBox1trois.Clear
    CheckBox1deux.Value = False
    CheckBox2deux.Value = False
    CheckBox3deux.Value = False
    CheckBox4deux.Value = False
    End If
    End Sub
     
    '******************************************************************************
    'PROCEDURE PERMETTANT DE REMPLIR LE ComboBox2trois A L'AIDE DU ComboBox1trois
    '******************************************************************************
     
    Private Sub ComboBox1trois_Change()
     
    'UserForm10.ComboBox1n = UserForm3.ComboBox1trois.Value 'Mettre automatiquement la valeur de ComboBox1trois dans ComboBox1n
     
    End Sub
     
    Private Sub ComboBox2trois_Change()
     
    End Sub
     
    Private Sub ComboBox3trois_Change()
     
    End Sub
     
    Private Sub CommandButton2trois_Click() 'Bouton precedent
     
     
    '************************************************************************************************************
    'PROCEDURE PERMETTANT DE VIDER TOUTES LES CELLULES DE LA FEUILLE SOURCE APRES CLIK SUR LE BOUTON PRECEDENT
    '************************************************************************************************************
     
     
     
    ActiveCell.Offset(0, 6).Value = ""
    ActiveCell.Offset(0, 7).Value = ""
    ActiveCell.Offset(0, 8).Value = ""
    ActiveCell.Offset(0, 9).Value = ""
    ActiveCell.Offset(0, 10).Value = ""
     
     
    '**********************************************************************
    'PROCEDURE PERMETTANT DE FAIRE LA REDIRECTION VERS LA PAGE PRECEDENTE
    '**********************************************************************
     
    UserForm3.Hide 'fermeture le l'interface UserForm2
    UserForm2.Show 'Redirection la page vers la feuille excel OBSERVATOIRE
     
    End Sub
     
    Private Sub CommandButton1trois_Click() 'Bouton suivant
     
     
    '**************************
    'DECLARATION DES VARIABLES
    '**************************
    Dim Prepaye As String
    Dim Postpaye As String
     
    Dim a As String
    Dim b As String
    Dim c As String
    Dim d As String
     
    Dim l As String
    Dim m As String
     
     
    '**************************
    'AFFECTATION DES VARIABLES
    '**************************
    a = "Non coche"
    b = "Non coche"
    c = "Non coche"
    d = "Non coche"
     
     
    l = "Non coche"
    m = "Non coche"
     
    'Boutons radio
     
    If OptionButton2.Value = True Then 'Si OptionButton2 = Vrai alors
     
    l = "Coche" 'met cellule Coche
     
    Else 'Sinon
     
    l = "Non coche" 'met cellule Non coche
     
    End If 'Fin du si
     
    If OptionButton1.Value = True Then
     
    m = "Coche"
     
    Else
     
    m = "Non coche"
     
    End If
     
     
     
    '***********************************************************************************************
    'PROCEDURE PERMETTANT DE COCHER LES CELLULES DANS LE FICHIER EXCEL A L'AIDE DU CheckBox1deux
    '***********************************************************************************************
     
     
    If CheckBox1deux.Value = True Then 'Si CheckBox1deux = Vrai
    a = "Coche" 'mettre a = coche
    End If
     
    If CheckBox2deux.Value = True Then
    b = "Coche"
    End If
     
    If CheckBox3deux.Value = True Then
    c = "Coche"
    End If
     
    If CheckBox4deux.Value = True Then
    d = "Coche"
    End If
     
    'If IsNumeric(TextBox1trois.Value) <> True Then 'Sinon si textBox1trois numerique est different de vrai
    'Beep
    'MsgBox "Mois est numerique" 'afficher ce texte ("Mois est numerique" )
     
    If ComboBox3trois = "Postpaye" Then 'Sinon si ComboBox4deux = Non
    Beep
    MsgBox "STOP INTERVIEW" 'afficher ce message STOP INTERVIEW
     
     
     
    ElseIf CheckBox1deux = False And CheckBox2deux = False And CheckBox3deux = False And CheckBox4deux = False Then
     
    Beep
    MsgBox "Veuillez remplir tous les champs svp!!!"
     
    ElseIf ComboBox1trois = "" Then
     
    Beep
    MsgBox "Veuillez remplir tous les champs svp!!!"
     
     
    ElseIf OptionButton2 = False And OptionButton1 = False Then
     
    Beep
    MsgBox "Veuillez remplir tous les champs svp!!!"
     
    ElseIf ComboBox3trois = "" Then
     
    Beep
    MsgBox "Veuillez remplir tous les champs svp!!!"
     
     
    Else
     
    '****************************************************
    'PROCEDURE PERMETTANT DE REMPLIR LA BASE DE DONNEES
    '****************************************************
    'Sheets("test").Activate 'Fais les instructions ci-dessous
    'Range("A1").Select
    'Selection.End(xlDown).Select
    'Selection.Offset(1, 0).Select
     
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
     
     
    'ActiveCell.Offset(0, 0).Value = a
    'ActiveCell.Offset(0, 1).Value = b
    'ActiveCell.Offset(0, 2).Value = c
    'ActiveCell.Offset(0, 3).Value = d
    'ActiveCell.Offset(0, 4).Value = ComboBox1trois.Value
    'ActiveCell.Offset(0, 5).Value = TextBox1trois '.Value
     
    'ActiveCell.Offset(0, 6).Value = l
    'ActiveCell.Offset(0, 7).Value = m
     
    'ActiveCell.Offset(0, 8).Value = ComboBox3trois.Value
     
     
     
    ActiveCell.Offset(0, 11).Value = a
    ActiveCell.Offset(0, 12).Value = b
    ActiveCell.Offset(0, 13).Value = c
    ActiveCell.Offset(0, 14).Value = d
    ActiveCell.Offset(0, 15).Value = ComboBox1trois.Value
    ActiveCell.Offset(0, 16).Value = TextBox1trois.Value
     
    ActiveCell.Offset(0, 17).Value = l
    ActiveCell.Offset(0, 18).Value = m
    ActiveCell.Offset(0, 19).Value = ComboBox3trois.Value
     
     
    CheckBox1deux.Value = False
    CheckBox2deux.Value = False
    CheckBox3deux.Value = False
    CheckBox4deux.Value = False
     
    'ComboBox1trois = ""
    'TextBox1trois = ""
    'OptionButton2 = False
    'OptionButton1 = False
    'ComboBox2trois = ""
    'ComboBox3trois = ""
     
     
    UserForm3.Hide 'fermeture UserForm3
    UserForm5.Show 'Afficher UserForm5
    End If
    End Sub
     
    Private Sub Label8deux_Click()
     
    End Sub
     
    Private Sub Frame1trois_Click()
     
    End Sub
     
    Private Sub Frame2_Click()
     
    End Sub
     
    Private Sub OptionButton1_Click()
     
    End Sub
     
    Private Sub OptionButton2_Click()
     
     
     
    End Sub
     
    Private Sub TextBox1trois_Change()
     
     
     
    End Sub
     
    Private Sub TextBox2trois_Change()
     
     
    End Sub
     
    Private Sub UserForm_Click()
     
    End Sub
     
    Private Sub UserForm_Initialize()
     
    End Sub
     
    '..........................................................................................................FIN DE CODE...............................................................................
     
     
    ET voici mon code de mon UserForm10
     
    Private Sub ComboBox1n_Change()
     
    ComboBox1n = Range("P1").Select
     
    End Sub
     
    Private Sub ComboBox4n_Change()
     
    End Sub
     
     
    Private Sub CommandButton1n_Click()
     
     
    ActiveCell.Offset(0, 38).Value = ""
    ActiveCell.Offset(0, 39).Value = ""
     
    '**********************************************************************
    'PROCEDURE PERMETTANT DE FAIRE LA REDIRECTION VERS LA PAGE PRECEDENTE
    '**********************************************************************
     
    UserForm10.Hide 'fermeture le l'interface UserForm10
    UserForm9.Show 'Redirection l'UserForm9
     
    End Sub
     
    Private Sub CommandButton2n_Click()
     
    'Dim a As String
    'Dim b As String
    'Dim c As String
    'Dim d As String
     
    'Dim z As String
     
    'a = "1 - Sonatel/Orange"
    'b = "13 - Kirene"
    'c = "14 - Tigo"
    'd = "15 - Expresso"
     
    'Fram operateur principal
     
    'If OptionButton1n.Value = True Then
     
    'z = a
     
    'ElseIf OptionButton4n.Value = True Then
     
    'z = b
     
    'ElseIf OptionButton5n.Value = True Then
     
    'z = c
     
    'ElseIf OptionButton6n.Value = True Then
     
    'z = d
     
    'End If
     
     
     
    If ComboBox4n = "" Then
    Beep
    MsgBox "Veuillez remplir tous les champs svp!!!"
     
    'ElseIf OptionButton1n = False And OptionButton4n = False And OptionButton5n = False And OptionButton6n = False Then 'Il faut cocher au moins un
    'Beep
    'MsgBox "Veuillez remplir tous les champs svp!!!"
     
     
    ElseIf ComboBox4n = "Non" Then
    Beep
    MsgBox "STOP INTER" 'afficher ce message STOP INTER
     
     
    Else
    '****************************************************
    'PROCEDURE PERMETTANT DE REMPLIR LA FEUILLLE OBS3
    '****************************************************
     
    'Sheets("OBS8").Activate 'Fais les instructions ci-dessous
    'Range("A1").Select
    'Selection.End(xlDown).Select
    'Selection.Offset(1, 0).Select
     
    ActiveCell.Offset(0, 40).Value = ComboBox4n
    ActiveCell.Offset(0, 41).Value = ComboBox1n
     
     
    UserForm10.Hide 'fermeture UserForm10
    UserForm11.Show 'Afficher UserForm11
     
    End If
    End Sub
     
    Private Sub CommandButton2deux_Click()
     
    End Sub
     
    Private Sub UserForm_Click()
     
    End Sub
     
     
    Private Sub UserForm_Initialize()
     
    ComboBox1n.List = UserForm3.ComboBox1trois.List
     
    End Sub

    Merci

    Bien cordialement


    sene1

  2. #2
    Expert éminent
    Avatar de Marc-L
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Avril 2013
    Messages
    9 468
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2013
    Messages : 9 468
    Par défaut
    Bonjour,

    en fait dans la ligne de code n° …     Ah zut ‼   Le code n'a pas été balisé comme le requièrent les règles de ce forum !

    Quand ce sera fait, merci aussi d'indiquer dans quelle partie du code c'est nécessaire.

    ___________________________________________________________________________________________________________
    Je suis Paris, Egypte, Nigeria, New-York, Mogadicio, Barcelone, London, Manchester, Stockholm, Istanbul, Berlin, Nice, Bruxelles, Charlie, …

Discussions similaires

  1. Réponses: 0
    Dernier message: 05/05/2010, 03h35
  2. Remplir une table dans la BD a partir d'1 fichier .txt
    Par aziz_mtl dans le forum PL/SQL
    Réponses: 4
    Dernier message: 04/04/2009, 00h34
  3. Remplir un formulaire dans une Pop-Up à partir de la fenêtre appelante
    Par Grizzzly dans le forum Général JavaScript
    Réponses: 8
    Dernier message: 15/02/2008, 09h06
  4. Réponses: 4
    Dernier message: 28/09/2007, 14h24
  5. Remplir une feuille de calcul excel distante à partir d'un userform
    Par Kikumaru dans le forum Macros et VBA Excel
    Réponses: 4
    Dernier message: 30/05/2007, 10h43

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo