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 :

Recherche plusieurs valeurs [XL-2007]


Sujet :

Macros et VBA Excel

  1. #1
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    118
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Avril 2010
    Messages : 118
    Points : 76
    Points
    76
    Par défaut Recherche plusieurs valeurs
    Bonsoir à tous,

    Je recherche désespérément une solution à mon problème. Je ne trouve pas la fonction qui va me permettre de rechercher dans une feuille Excel et d'en ressortir le numéro de ligne. Par exemple, dans ma Feuil1, j'ai des valeurs en A2:B2:C22 et je voudrai retrouver dans quelle ligne se retrouver ces mêmes valeurs dans la Feuil2 en B:C:E.

    J'ai trouve sur le forum et le net en général plein d'exemple avec la fonction find mais je n'arrive pas à l'adapter. Tous les exemples que je trouve sont de la forme: je cherche une valeur unique contenu dans une cellule dans une plage de données.

    Si quelqu'un aurait l'amabilité de m'orienter, je vous serai très reconnaissant.

    Excellente soirée.

    Jordan M.

  2. #2
    Expert confirmé
    Homme Profil pro
    PAO
    Inscrit en
    Octobre 2014
    Messages
    2 576
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : PAO
    Secteur : Communication - Médias

    Informations forums :
    Inscription : Octobre 2014
    Messages : 2 576
    Points : 4 174
    Points
    4 174
    Par défaut
    Bonsoir,

    on peut déjà le faire sans vba avec la simple formule et puissante SOMMEPROD (je ne me suis pas occupé des adresses relatives ou absolues => donc à faire)
    Exemple :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    =SOMMEPROD((Feuil2!A1:A15=Feuil1!A1)*(Feuil2!B1:B15=Feuil1!B1)*(Feuil2!C1:C15=C1)*(Feuil2!D1:D15=Feuil1!D1)*LIGNE(Feuil2!A1:D15))
    Si la formule ne trouve pas le résultat sera 0
    Cordialement
    Ryu

    La connaissance s’acquiert par l’expérience, tout le reste n’est que de l’information. – Albert Einstein

    Pensez à la Balise [ CODE][/CODE ] - à utiliser via le bouton # => Exemple

    Une fois votre problème solutionné pensez à mettre en n'oubliant pas d'indiquer qu'elle est la solution finale choisie

  3. #3
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    118
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Avril 2010
    Messages : 118
    Points : 76
    Points
    76
    Par défaut Recherche multi-critères
    Bonjour,

    Merci pour votre réponse. Malheureusement votre solution ne correspond pas à mes besoins (navré j'ai oublié d'être plus précis). Il faut que je puisse le faire par VBA. Je souhaite récupérer le numéro de ligne correspondant au valeur qui sont identiques dans ma deuxième feuilles mais pas au même endroit afin de pouvoir les injecter dans des variables et pouvoir les utiliser plus tard

    Les valeurs contenues dans la Feuil1 seront toujours en Colonne A-B-C-D (avec utilisation de activecell.row pour le numéro de ligne) et pour la Feuil2, les mêmes valeurs qui ne sont présente forcément qu'une seule fois commencent à partir de la colonne B jusqu'à E dans un range allant de A12:W100

    Merci d'avance pour votre réponse.

    Excellente journee.
    Jordan M.

  4. #4
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    118
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Avril 2010
    Messages : 118
    Points : 76
    Points
    76
    Par défaut Recherche multi-critères
    Parfois la nuit porte conseil

    J'ai réussi à adapter un code que j'ai trouvé sur le forum. Je trouve bien les informations que je souhaitais récupérer. Par contre, comment faire pour sortir de la boucle quand l'instruction code1=code2 a été trouvée et que les instructions du dessous ont été exécutées (étant donné qu'elle ne se trouve une seule fois sur la feuille 05_mai)?

    Voici mon code:

    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
    With Sheets("Suivi dossiers personnels")
    code1 = .Range("A" & ActiveCell.Row) & .Range("B" & ActiveCell.Row) & .Range("C" & ActiveCell.Row) & .Range("D" & ActiveCell.Row) & .Range("E" & ActiveCell.Row) & _
        .Range("F" & ActiveCell.Row) & .Range("G" & ActiveCell.Row) & .Range("H" & ActiveCell.Row) & .Range("I" & ActiveCell.Row) & .Range("J" & ActiveCell.Row)
    End With
    ActiveWorkbook.Worksheets("05_Mai").Unprotect
    With Sheets("05_Mai")
     For j = Range("B" & Rows.Count).End(xlUp).Row To 12 Step -1
            code2 = .Range("B" & j) & .Range("C" & j) & .Range("D" & j) & .Range("E" & j) & .Range("F" & j) & _
        .Range("G" & j) & .Range("H" & j) & .Range("I" & j) & .Range("J" & j) & .Range("K" & j)
            If code2 = code1 Then Type_temp = ActiveWorkbook.Worksheets("05_Mai").Range("L" & j)
    Dublin_temp = ActiveWorkbook.Worksheets("05_Mai").Range("M" & j)
    Nationalite_temp = ActiveWorkbook.Worksheets("05_Mai").Range("N" & j).Value
    Legitimite_temp = ActiveWorkbook.Worksheets("05_Mai").Range("O" & j).Value
    Validite_temp = ActiveWorkbook.Worksheets("05_Mai").Range("P" & j).Value
    Remarques_temp = ActiveWorkbook.Worksheets("05_Mai").Range("R" & j).Value
    .Rows(j).Delete
        Next j
    End With
    En vous souhaitant une excellente journée.

    JORDAN M.

  5. #5
    Invité
    Invité(e)
    Par défaut
    Bonjour,

    Tu peux utiliser un Exit For pour sortir de ta boucle.

  6. #6
    Invité
    Invité(e)
    Par défaut
    https://www.developpez.net/forums/d1...a/#post9342612

    bonjour,
    tu peux adapter le code pour un recherche sur 3 entrées!

  7. #7
    Expert confirmé
    Homme Profil pro
    PAO
    Inscrit en
    Octobre 2014
    Messages
    2 576
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : PAO
    Secteur : Communication - Médias

    Informations forums :
    Inscription : Octobre 2014
    Messages : 2 576
    Points : 4 174
    Points
    4 174
    Par défaut
    Bonjour,

    Quel est le nombre de lignes total ?
    Une autre solution serait de passer par une collection et un tableau avec la concaténation des cellules en feuille 1 pour la collection (permettant de créer la clé d'identification, avec en valeur pour l'item le n• de ligne)
    et pour le tableau la concaténation des cellules en feuille 2 afin de savoir si le doublon existe.
    Dans le cas où il y'a doublon, alors faire les actions souhaitées.

    À voir …
    Cordialement
    Ryu

    La connaissance s’acquiert par l’expérience, tout le reste n’est que de l’information. – Albert Einstein

    Pensez à la Balise [ CODE][/CODE ] - à utiliser via le bouton # => Exemple

    Une fois votre problème solutionné pensez à mettre en n'oubliant pas d'indiquer qu'elle est la solution finale choisie

  8. #8
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    118
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Avril 2010
    Messages : 118
    Points : 76
    Points
    76
    Par défaut Recherche multi-critères
    Bonjour,

    Merci pour vos réponse. Je suis vraiment novice en VBA mais j'ai toujours réussi à adapter les codes. Malheureusement, la je n'y arrive vraiment pas.

    Pour ta solution Oudouner:

    Impossible de placer correctement le Exit For. Je n'obtiens aucun message d'erreur si j'ajoute le code ci-dessous mais cela ne fonctionne pas. J'ai l'impression que cela ne prend déjà pas en compte if code2=code1 then car il m'exécute quand même les instruction dessous même si les valeurs ne sont pas identiques.

    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
    Else
    With Sheets("Suivi dossiers personnels")
    code1 = .Range("A" & ActiveCell.Row) & .Range("B" & ActiveCell.Row) & .Range("C" & ActiveCell.Row) & .Range("D" & ActiveCell.Row) & .Range("E" & ActiveCell.Row) & _
        .Range("F" & ActiveCell.Row) & .Range("G" & ActiveCell.Row) & .Range("H" & ActiveCell.Row) & .Range("I" & ActiveCell.Row) & .Range("J" & ActiveCell.Row)
    End With
    ActiveWorkbook.Worksheets("05_Mai").Unprotect
    With Sheets("05_Mai")
     For j = Range("B" & Rows.Count).End(xlUp).Row To 12 Step -1
            code2 = .Range("B" & j) & .Range("C" & j) & .Range("D" & j) & .Range("E" & j) & .Range("F" & j) & _
        .Range("G" & j) & .Range("H" & j) & .Range("I" & j) & .Range("J" & j) & .Range("K" & j)
            If code2 = code1 Then Type_temp = ActiveWorkbook.Worksheets("05_Mai").Range("L" & j)
    Dublin_temp = ActiveWorkbook.Worksheets("05_Mai").Range("M" & j)
    Nationalite_temp = ActiveWorkbook.Worksheets("05_Mai").Range("N" & j).Value
    Legitimite_temp = ActiveWorkbook.Worksheets("05_Mai").Range("O" & j).Value
    Validite_temp = ActiveWorkbook.Worksheets("05_Mai").Range("P" & j).Value
    Lieu_temp = ActiveWorkbook.Worksheets("05_Mai").Range("Q" & j).Value
    Remarques_temp = ActiveWorkbook.Worksheets("05_Mai").Range("R" & j).Value
    .Rows(j).Delete
    Exit For
        Next j
    End With
    End If
    Et si je place ainsi mon code j'obtiens "Boucle Next sans for (je comprends pas du tout pourquoi)

    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
    Else
    With Sheets("Suivi dossiers personnels")
    code1 = .Range("A" & ActiveCell.Row) & .Range("B" & ActiveCell.Row) & .Range("C" & ActiveCell.Row) & .Range("D" & ActiveCell.Row) & .Range("E" & ActiveCell.Row) & _
        .Range("F" & ActiveCell.Row) & .Range("G" & ActiveCell.Row) & .Range("H" & ActiveCell.Row) & .Range("I" & ActiveCell.Row) & .Range("J" & ActiveCell.Row)
    End With
    ActiveWorkbook.Worksheets("05_Mai").Unprotect
    With Sheets("05_Mai")
     For j = Range("B" & Rows.Count).End(xlUp).Row To 12 Step -1
            code2 = .Range("B" & j) & .Range("C" & j) & .Range("D" & j) & .Range("E" & j) & .Range("F" & j) & _
        .Range("G" & j) & .Range("H" & j) & .Range("I" & j) & .Range("J" & j) & .Range("K" & j)
            If code2 = code1 Then
    Type_temp = ActiveWorkbook.Worksheets("05_Mai").Range("L" & j)
    Dublin_temp = ActiveWorkbook.Worksheets("05_Mai").Range("M" & j)
    Nationalite_temp = ActiveWorkbook.Worksheets("05_Mai").Range("N" & j).Value
    Legitimite_temp = ActiveWorkbook.Worksheets("05_Mai").Range("O" & j).Value
    Validite_temp = ActiveWorkbook.Worksheets("05_Mai").Range("P" & j).Value
    Lieu_temp = ActiveWorkbook.Worksheets("05_Mai").Range("Q" & j).Value
    Remarques_temp = ActiveWorkbook.Worksheets("05_Mai").Range("R" & j).Value
    .Rows(j).Delete
    Exit For
        Next j
    End With
    End If
    Pour ta solution Dysorthographie:

    Je comprends rien au code mais je vais me pencher plus sérieusement dessus pour voir si cela pourrait etre une solution

    Pour ta solution RyuAutodidacte:

    Le nombre de ligne dans les deux tableaux sont variables. Je recherche a chaque fois à l'aide de:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Range("B" & Rows.Count).End(xlUp).Row
    Et si je comprends bien ce que tu m'expliques, je me demande comment cela pourrait fonctionner si tu attribues le numéro de ligne à la clé d'identification car sur la feuille2, ce numéro de ligne n'est pas identique. Enfin, pas certain d'avoir tout compris car je ne connais pas les collections.

  9. #9
    Expert confirmé
    Homme Profil pro
    PAO
    Inscrit en
    Octobre 2014
    Messages
    2 576
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : PAO
    Secteur : Communication - Médias

    Informations forums :
    Inscription : Octobre 2014
    Messages : 2 576
    Points : 4 174
    Points
    4 174
    Par défaut
    Re,

    Tu en fais quoi des variables une fois récupérées ?
    Car il faut que l'on sache la finalité de ce que tu veux faire pour choisir la bonne méthode mais aussi afin de coder en conséquence sans égarements.

    J'ai regardé vite fait ton code (je suis sur mon phone) mais si je me trompe pas, ton code s'arrête à la récupération de ces variables.

    Plus on a de détails avec les bonnes explications mieux c'est…
    Cordialement
    Ryu

    La connaissance s’acquiert par l’expérience, tout le reste n’est que de l’information. – Albert Einstein

    Pensez à la Balise [ CODE][/CODE ] - à utiliser via le bouton # => Exemple

    Une fois votre problème solutionné pensez à mettre en n'oubliant pas d'indiquer qu'elle est la solution finale choisie

  10. #10
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    118
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Avril 2010
    Messages : 118
    Points : 76
    Points
    76
    Par défaut Recherche multi-critères
    Re,

    Merci pour la réponse. Les variables je les stocke afin de pouvoir les insérer dans une nouvelle feuille après coup. En faite, il s'agit d'un code qui est déclencher par un bouton sur un userform "Modification mandat". Dans les grandes lignes, l'utilisateur peut ajouter un mandat avec des données générales (date du mandat, nom, prénom, etc...) à l'aide d'un userform "Ajout mandat" sur la Feuil "Suivi dossiers personnels". Ces données sont automatiquement copiés sur une autre feuil "05_Mai", "06_Juin" , etc.. en fonction de la datedu mandat justement (afin d'avoir un onglet par mois). Dans ces onglets mensuels, les données de base du mandat sont donc inscrite mais non modifiable et d'autres colonnes permettent à l'utilisateur d'insérer d'autres informations sur ce mandat (ex: lieu, type de mandat, etc...)

    Je souhaite donc prévoir que l'utilisateur puisse s'être trompé dans la date du dossier par exemple et pouvoir la modifier depuis les données générales. De ce fait, je dois donc prendre en compte que les données présentes dans les feuilles mensuelles doivent être stockées dans des variables. Je recherche la ligne correspondante, je stock les variables, ensuite je supprime la ligne et j'ajoute une nouvelle ligne au bon endroit avec les valeurs modifiées des textboxs et comboboxs du userform "Modifier mandat" + les variables stockées. (Je sais pas si je suis bien clair )

    Selon demande, je transmets ci-joint mon code complet du userform "Modifier mandat" (je l'avais pas mis avant, je le pensais trop long)

    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
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    Private Sub CommandButton2_Click()
     
    If TextBox3.Value = "" Or TextBox4.Value = "" Or TextBox5.Value = "" Or TextBox6.Value = "" Or ComboBox1.Value = "" Or ComboBox1.Value = "Oui" And ComboBox2.Value = "" Then
     
    If TextBox3.Value = "" Then Label6.ForeColor = &HFF&
    If TextBox3.Value <> "" Then Label6.ForeColor = &H80000012
    If TextBox4.Value = "" Then Label5.ForeColor = &HFF&
    If TextBox4.Value <> "" Then Label5.ForeColor = &H80000012
    If TextBox5.Value = "" Then Label4.ForeColor = &HFF&
    If TextBox5.Value <> "" Then Label4.ForeColor = &H80000012
    If TextBox6.Value = "" Then Label3.ForeColor = &HFF&
    If TextBox6.Value <> "" Then Label3.ForeColor = &H80000012
    If ComboBox1.Value = "" Then Label2.ForeColor = &HFF&
    If ComboBox1.Value <> "" Then Label2.ForeColor = &H80000012
    If ComboBox1.Value = "Oui" And ComboBox2.Value = "" Then Label9.ForeColor = &HFF&
    If ComboBox1.Value = "Oui" And ComboBox2.Value <> "" Then Label9.ForeColor = &H80000012
    UserForm_infochamps.Show
    Exit Sub
    End If
     
    Unload UserForm_modifier
    Userform_patienter.Show vbModeless
     
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
     
    ActiveWorkbook.Save
     
    DrLig = ActiveCell.Row
    Mois_temp = Range("D" & DrLig)
    Sortie_temp = Range("J" & DrLig)
     
    If Sortie_temp = "Oui" Then
    If Sortie_temp <> ComboBox1.Value Then
    With Sheets("Suivi dossiers personnels")
    code1 = .Range("A" & ActiveCell.Row) & .Range("B" & ActiveCell.Row) & .Range("C" & ActiveCell.Row) & .Range("D" & ActiveCell.Row) & .Range("E" & ActiveCell.Row) & _
        .Range("F" & ActiveCell.Row) & .Range("G" & ActiveCell.Row) & .Range("H" & ActiveCell.Row) & .Range("I" & ActiveCell.Row) & .Range("J" & ActiveCell.Row)
    End With
    ActiveWorkbook.Worksheets("Sortie_prison").Unprotect
    With Sheets("Sortie_prison")
     For j = Range("B" & Rows.Count).End(xlUp).Row To 12 Step -1
            code2 = .Range("B" & j) & .Range("C" & j) & .Range("D" & j) & .Range("E" & j) & .Range("F" & j) & _
        .Range("G" & j) & .Range("H" & j) & .Range("I" & j) & .Range("J" & j) & .Range("K" & j)
            If code2 = code1 Then Type_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("M" & j)
    Dublin_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("N" & j)
    Nationalite_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("O" & j)
    Legitimite_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("P" & j)
    Validite_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("Q" & j)
    Remarques_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("W" & j)
    .Rows(j).Delete
        Next j
        End With
    Else
    With Sheets("Suivi dossiers personnels")
    code1 = .Range("A" & ActiveCell.Row) & .Range("B" & ActiveCell.Row) & .Range("C" & ActiveCell.Row) & .Range("D" & ActiveCell.Row) & .Range("E" & ActiveCell.Row) & _
        .Range("F" & ActiveCell.Row) & .Range("G" & ActiveCell.Row) & .Range("H" & ActiveCell.Row) & .Range("I" & ActiveCell.Row) & .Range("J" & ActiveCell.Row)
    End With
    ActiveWorkbook.Worksheets("Sortie_prison").Unprotect
    With Sheets("Sortie_prison")
     For j = Range("B" & Rows.Count).End(xlUp).Row To 12 Step -1
            code2 = .Range("B" & j) & .Range("C" & j) & .Range("D" & j) & .Range("E" & j) & .Range("F" & j) & _
        .Range("G" & j) & .Range("H" & j) & .Range("I" & j) & .Range("J" & j) & .Range("K" & j)
            If code2 = code1 Then Type_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("M" & j)
    Dublin_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("N" & j)
    Nationalite_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("O" & j)
    Legitimite_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("P" & j)
    Validite_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("Q" & j)
    Dateentree_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("R" & j)
    Date23_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("S" & j)
    Datesortie_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("U" & j)
    Remarques_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("W" & j)
    .Rows(j).Delete
        Next j
    End With
    End If
    End If
     
    If Sortie_temp = "Non" And Mois_temp = "5" Then
    If Sortie_temp <> ComboBox1.Value Then
    With Sheets("Suivi dossiers personnels")
    code1 = .Range("A" & ActiveCell.Row) & .Range("B" & ActiveCell.Row) & .Range("C" & ActiveCell.Row) & .Range("D" & ActiveCell.Row) & .Range("E" & ActiveCell.Row) & _
        .Range("F" & ActiveCell.Row) & .Range("G" & ActiveCell.Row) & .Range("H" & ActiveCell.Row) & .Range("I" & ActiveCell.Row) & .Range("J" & ActiveCell.Row)
    End With
    ActiveWorkbook.Worksheets("05_Mai").Unprotect
    With Sheets("05_Mai")
     For j = Range("B" & Rows.Count).End(xlUp).Row To 12 Step -1
            code2 = .Range("B" & j) & .Range("C" & j) & .Range("D" & j) & .Range("E" & j) & .Range("F" & j) & _
        .Range("G" & j) & .Range("H" & j) & .Range("I" & j) & .Range("J" & j) & .Range("K" & j)
            If code2 = code1 Then Type_temp = ActiveWorkbook.Worksheets("05_Mai").Range("L" & j)
    Dublin_temp = ActiveWorkbook.Worksheets("05_Mai").Range("M" & j)
    Nationalite_temp = ActiveWorkbook.Worksheets("05_Mai").Range("N" & j).Value
    Legitimite_temp = ActiveWorkbook.Worksheets("05_Mai").Range("O" & j).Value
    Validite_temp = ActiveWorkbook.Worksheets("05_Mai").Range("P" & j).Value
    Remarques_temp = ActiveWorkbook.Worksheets("05_Mai").Range("R" & j).Value
    .Rows(j).Delete
        Next j
    End With
    Else
    With Sheets("Suivi dossiers personnels")
    code1 = .Range("A" & ActiveCell.Row) & .Range("B" & ActiveCell.Row) & .Range("C" & ActiveCell.Row) & .Range("D" & ActiveCell.Row) & .Range("E" & ActiveCell.Row) & _
        .Range("F" & ActiveCell.Row) & .Range("G" & ActiveCell.Row) & .Range("H" & ActiveCell.Row) & .Range("I" & ActiveCell.Row) & .Range("J" & ActiveCell.Row)
    End With
    ActiveWorkbook.Worksheets("05_Mai").Unprotect
    With Sheets("05_Mai")
     For j = Range("B" & Rows.Count).End(xlUp).Row To 12 Step -1
            code2 = .Range("B" & j) & .Range("C" & j) & .Range("D" & j) & .Range("E" & j) & .Range("F" & j) & _
        .Range("G" & j) & .Range("H" & j) & .Range("I" & j) & .Range("J" & j) & .Range("K" & j)
            If code2 = code1 Then Type_temp = ActiveWorkbook.Worksheets("05_Mai").Range("L" & j)
    Dublin_temp = ActiveWorkbook.Worksheets("05_Mai").Range("M" & j)
    Nationalite_temp = ActiveWorkbook.Worksheets("05_Mai").Range("N" & j).Value
    Legitimite_temp = ActiveWorkbook.Worksheets("05_Mai").Range("O" & j).Value
    Validite_temp = ActiveWorkbook.Worksheets("05_Mai").Range("P" & j).Value
    Lieu_temp = ActiveWorkbook.Worksheets("05_Mai").Range("Q" & j).Value
    Remarques_temp = ActiveWorkbook.Worksheets("05_Mai").Range("R" & j).Value
    .Rows(j).Delete
        Next j
    End With
    End If
    End If
     
    If Sortie_temp = "Non" And Mois_temp = "6" Then
    If Sortie_temp <> ComboBox1.Value Then
    With Sheets("Suivi dossiers personnels")
    code1 = .Range("A" & ActiveCell.Row) & .Range("B" & ActiveCell.Row) & .Range("C" & ActiveCell.Row) & .Range("D" & ActiveCell.Row) & .Range("E" & ActiveCell.Row) & _
        .Range("F" & ActiveCell.Row) & .Range("G" & ActiveCell.Row) & .Range("H" & ActiveCell.Row) & .Range("I" & ActiveCell.Row) & .Range("J" & ActiveCell.Row)
    End With
    ActiveWorkbook.Worksheets("06_Juin").Unprotect
    With Sheets("06_Juin")
     For j = Range("B" & Rows.Count).End(xlUp).Row To 12 Step -1
            code2 = .Range("B" & j) & .Range("C" & j) & .Range("D" & j) & .Range("E" & j) & .Range("F" & j) & _
        .Range("G" & j) & .Range("H" & j) & .Range("I" & j) & .Range("J" & j) & .Range("K" & j)
            If code2 = code1 Then Type_temp = ActiveWorkbook.Worksheets("06_Juin").Range("L" & j)
    Dublin_temp = ActiveWorkbook.Worksheets("06_Juin").Range("M" & j)
    Nationalite_temp = ActiveWorkbook.Worksheets("06_Juin").Range("N" & j).Value
    Legitimite_temp = ActiveWorkbook.Worksheets("06_Juin").Range("O" & j).Value
    Validite_temp = ActiveWorkbook.Worksheets("06_Juin").Range("P" & j).Value
    Remarques_temp = ActiveWorkbook.Worksheets("06_Juin").Range("R" & j).Value
    .Rows(j).Delete
        Next j
    End With
    Else
    With Sheets("Suivi dossiers personnels")
    code1 = .Range("A" & ActiveCell.Row) & .Range("B" & ActiveCell.Row) & .Range("C" & ActiveCell.Row) & .Range("D" & ActiveCell.Row) & .Range("E" & ActiveCell.Row) & _
        .Range("F" & ActiveCell.Row) & .Range("G" & ActiveCell.Row) & .Range("H" & ActiveCell.Row) & .Range("I" & ActiveCell.Row) & .Range("J" & ActiveCell.Row)
    End With
    ActiveWorkbook.Worksheets("06_Juin").Unprotect
    With Sheets("06_Juin")
     For j = Range("B" & Rows.Count).End(xlUp).Row To 12 Step -1
            code2 = .Range("B" & j) & .Range("C" & j) & .Range("D" & j) & .Range("E" & j) & .Range("F" & j) & _
        .Range("G" & j) & .Range("H" & j) & .Range("I" & j) & .Range("J" & j) & .Range("K" & j)
            If code2 = code1 Then Type_temp = ActiveWorkbook.Worksheets("06_Juin").Range("L" & j)
    Dublin_temp = ActiveWorkbook.Worksheets("06_Juin").Range("M" & j)
    Nationalite_temp = ActiveWorkbook.Worksheets("06_Juin").Range("N" & j).Value
    Legitimite_temp = ActiveWorkbook.Worksheets("06_Juin").Range("O" & j).Value
    Validite_temp = ActiveWorkbook.Worksheets("06_Juin").Range("P" & j).Value
    Lieu_temp = ActiveWorkbook.Worksheets("06_Juin").Range("Q" & j).Value
    Remarques_temp = ActiveWorkbook.Worksheets("06_Juin").Range("R" & j).Value
    .Rows(j).Delete
        Next j
    End With
    End If
    End If
     
    If Sortie_temp = "Non" And Mois_temp = "7" Then
    If Sortie_temp <> ComboBox1.Value Then
    With Sheets("Suivi dossiers personnels")
    code1 = .Range("A" & ActiveCell.Row) & .Range("B" & ActiveCell.Row) & .Range("C" & ActiveCell.Row) & .Range("D" & ActiveCell.Row) & .Range("E" & ActiveCell.Row) & _
        .Range("F" & ActiveCell.Row) & .Range("G" & ActiveCell.Row) & .Range("H" & ActiveCell.Row) & .Range("I" & ActiveCell.Row) & .Range("J" & ActiveCell.Row)
    End With
    ActiveWorkbook.Worksheets("07_Juillet").Unprotect
    With Sheets("07_Juillet")
     For j = Range("B" & Rows.Count).End(xlUp).Row To 12 Step -1
            code2 = .Range("B" & j) & .Range("C" & j) & .Range("D" & j) & .Range("E" & j) & .Range("F" & j) & _
        .Range("G" & j) & .Range("H" & j) & .Range("I" & j) & .Range("J" & j) & .Range("K" & j)
            If code2 = code1 Then Type_temp = ActiveWorkbook.Worksheets("07_Juillet").Range("L" & j)
    Dublin_temp = ActiveWorkbook.Worksheets("07_Juillet").Range("M" & j)
    Nationalite_temp = ActiveWorkbook.Worksheets("07_Juillet").Range("N" & j).Value
    Legitimite_temp = ActiveWorkbook.Worksheets("07_Juillet").Range("O" & j).Value
    Validite_temp = ActiveWorkbook.Worksheets("07_Juillet").Range("P" & j).Value
    Remarques_temp = ActiveWorkbook.Worksheets("07_Juillet").Range("R" & j).Value
    .Rows(j).Delete
        Next j
    End With
    Else
    With Sheets("Suivi dossiers personnels")
    code1 = .Range("A" & ActiveCell.Row) & .Range("B" & ActiveCell.Row) & .Range("C" & ActiveCell.Row) & .Range("D" & ActiveCell.Row) & .Range("E" & ActiveCell.Row) & _
        .Range("F" & ActiveCell.Row) & .Range("G" & ActiveCell.Row) & .Range("H" & ActiveCell.Row) & .Range("I" & ActiveCell.Row) & .Range("J" & ActiveCell.Row)
    End With
    ActiveWorkbook.Worksheets("07_Juillet").Unprotect
    With Sheets("07_Juillet")
     For j = Range("B" & Rows.Count).End(xlUp).Row To 12 Step -1
            code2 = .Range("B" & j) & .Range("C" & j) & .Range("D" & j) & .Range("E" & j) & .Range("F" & j) & _
        .Range("G" & j) & .Range("H" & j) & .Range("I" & j) & .Range("J" & j) & .Range("K" & j)
            If code2 = code1 Then Type_temp = ActiveWorkbook.Worksheets("07_Juillet").Range("L" & j)
    Dublin_temp = ActiveWorkbook.Worksheets("07_Juillet").Range("M" & j)
    Nationalite_temp = ActiveWorkbook.Worksheets("07_Juillet").Range("N" & j).Value
    Legitimite_temp = ActiveWorkbook.Worksheets("07_Juillet").Range("O" & j).Value
    Validite_temp = ActiveWorkbook.Worksheets("07_Juillet").Range("P" & j).Value
    Lieu_temp = ActiveWorkbook.Worksheets("07_Juillet").Range("Q" & j).Value
    Remarques_temp = ActiveWorkbook.Worksheets("07_Juillet").Range("R" & j).Value
    .Rows(j).Delete
        Next j
    End With
    End If
    End If
     
    ActiveWorkbook.Worksheets("Suivi dossiers personnels").Unprotect
    ActiveWorkbook.Worksheets("Suivi dossiers personnels").Range("A" & DrLig).Value = TextBox1.Value
    ActiveWorkbook.Worksheets("Suivi dossiers personnels").Range("B" & DrLig).Value = TextBox2.Value
    ActiveWorkbook.Worksheets("Suivi dossiers personnels").Range("F" & DrLig).Value = TextBox3.Value
    ActiveWorkbook.Worksheets("Suivi dossiers personnels").Range("G" & DrLig).Value = UCase(TextBox4.Value)
    ActiveWorkbook.Worksheets("Suivi dossiers personnels").Range("H" & DrLig).Value = TextBox5.Value
    ActiveWorkbook.Worksheets("Suivi dossiers personnels").Range("I" & DrLig).Value = TextBox6.Value
    ActiveWorkbook.Worksheets("Suivi dossiers personnels").Range("J" & DrLig).Value = ComboBox1.Value
    ActiveWorkbook.Worksheets("Suivi dossiers personnels").Range("K" & DrLig).Value = ComboBox2.Value
    ActiveWorkbook.Worksheets("Suivi dossiers personnels").Protect
     
    ActiveWorkbook.Worksheets("Suivi dossiers personnels").ListObjects("Tableau1"). _
            Sort.SortFields.Clear
        ActiveWorkbook.Worksheets("Suivi dossiers personnels").ListObjects("Tableau1"). _
            Sort.SortFields.Add Key:=Range("Tableau1[Date dossier]"), SortOn:= _
            xlSortOnValues, Order:=xlAscending, DataOption:=xlSortTextAsNumbers
        ActiveWorkbook.Worksheets("Suivi dossiers personnels").ListObjects("Tableau1"). _
            Sort.SortFields.Add Key:=Range("Tableau1[Nom]"), SortOn:=xlSortOnValues, _
            Order:=xlAscending, DataOption:=xlSortNormal
        ActiveWorkbook.Worksheets("Suivi dossiers personnels").ListObjects("Tableau1"). _
            Sort.SortFields.Add Key:=Range("Tableau1[Prénom]"), SortOn:=xlSortOnValues _
            , Order:=xlAscending, DataOption:=xlSortNormal
        With ActiveWorkbook.Worksheets("Suivi dossiers personnels").ListObjects( _
            "Tableau1").Sort
            .Header = xlYes
            .MatchCase = False
            .Orientation = xlTopToBottom
            .SortMethod = xlPinYin
            .Apply
        End With
     
    If ComboBox1.Value = "Oui" Then
     
    If ActiveWorkbook.Worksheets("Sortie_prison").Range("F12").Value = "" Then
    ActiveWorkbook.Worksheets("Sortie_prison").Unprotect
    ActiveWorkbook.Worksheets("Sortie_prison").Range("B12").Value = TextBox1.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("C12").Value = TextBox2.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("D12").FormulaLocal = "=ANNEE([Date dossier])"
    ActiveWorkbook.Worksheets("Sortie_prison").Range("E12").FormulaLocal = "=MOIS([Date dossier])"
    ActiveWorkbook.Worksheets("Sortie_prison").Range("F12").FormulaLocal = "=JOUR([Date dossier])"
    ActiveWorkbook.Worksheets("Sortie_prison").Range("G12").Value = TextBox3.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("H12").Value = UCase(TextBox4.Value)
    ActiveWorkbook.Worksheets("Sortie_prison").Range("I12").Value = TextBox5.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("J12").Value = TextBox6.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("K12").Value = ComboBox1.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("L12").Value = ComboBox2.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("M12").Value = Type_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("N12").Value = Dublin_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("O12").Value = Nationalite_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("P12").Value = Legitimite_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("Q12").Value = Validite_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("R12").Value = Dateentree_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("S12").Value = Date23_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("U12").Value = Datesortie_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("W12").Value = Remarques
    ActiveWorkbook.Worksheets("Sortie_prison").Protect DrawingObjects:=False
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
    Unload Userform_patienter
    UserForm_operationsucces.Show
    Exit Sub
    Else
    DerLign = ActiveWorkbook.Worksheets("Sortie_prison").Range("A" & Rows.Count).End(xlUp).Row + 1
    ActiveWorkbook.Worksheets("Sortie_prison").Unprotect
    ActiveWorkbook.Worksheets("Sortie_prison").Range("B" & DerLign).Value = TextBox1.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("C" & DerLign).Value = TextBox2.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("D" & DerLign).FormulaLocal = "=ANNEE([Date dossier])"
    ActiveWorkbook.Worksheets("Sortie_prison").Range("E" & DerLign).FormulaLocal = "=MOIS([Date dossier])"
    ActiveWorkbook.Worksheets("Sortie_prison").Range("F" & DerLign).FormulaLocal = "=JOUR([Date dossier])"
    ActiveWorkbook.Worksheets("Sortie_prison").Range("G" & DerLign).Value = TextBox3.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("H" & DerLign).Value = UCase(TextBox4.Value)
    ActiveWorkbook.Worksheets("Sortie_prison").Range("I" & DerLign).Value = TextBox5.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("J" & DerLign).Value = TextBox6.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("K" & DerLign).Value = ComboBox1.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("L" & DerLign).Value = ComboBox2.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("M" & DerLign).Value = Type_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("N" & DerLign).Value = Dublin_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("O" & DerLign).Value = Nationalite_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("P" & DerLign).Value = Legitimite_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("Q" & DerLign).Value = Validite_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("R" & DerLign).Value = Dateentree_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("S" & DerLign).Value = Date23_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("U" & DerLign).Value = Datesortie_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("W" & DerLign).Value = Remarques
     
      ActiveWorkbook.Worksheets("Sortie_prison").ListObjects("T_Prison").Sort. _
            SortFields.Clear
        ActiveWorkbook.Worksheets("Sortie_prison").ListObjects("T_Prison").Sort. _
            SortFields.Add Key:=Range("T_Prison[Date dossier]"), SortOn:=xlSortOnValues _
            , Order:=xlAscending, DataOption:=xlSortTextAsNumbers
        ActiveWorkbook.Worksheets("Sortie_prison").ListObjects("T_Prison").Sort. _
            SortFields.Add Key:=Range("T_Prison[Nom]"), SortOn:=xlSortOnValues, Order _
            :=xlAscending, DataOption:=xlSortNormal
        ActiveWorkbook.Worksheets("Sortie_prison").ListObjects("T_Prison").Sort. _
            SortFields.Add Key:=Range("T_Prison[Prénom]"), SortOn:=xlSortOnValues, _
            Order:=xlAscending, DataOption:=xlSortNormal
        With ActiveWorkbook.Worksheets("Sortie_prison").ListObjects("T_Prison").Sort
            .Header = xlYes
            .MatchCase = False
            .Orientation = xlTopToBottom
            .SortMethod = xlPinYin
            .Apply
        End With
    ActiveWorkbook.Worksheets("Sortie_prison").Protect DrawingObjects:=False
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
    Unload Userform_patienter
    UserForm_operationsucces.Show
    Exit Sub
    End If
    End If
     
    If ComboBox1.Value = "Non" And TextBox7.Value = "5" Then
     
    If ActiveWorkbook.Worksheets("05_Mai").Range("F12").Value = "" Then
    ActiveWorkbook.Worksheets("05_Mai").Unprotect
    ActiveWorkbook.Worksheets("05_Mai").Range("B12").Value = TextBox1.Value
    ActiveWorkbook.Worksheets("05_Mai").Range("C12").Value = TextBox2.Value
    ActiveWorkbook.Worksheets("05_Mai").Range("D12").FormulaLocal = "=ANNEE([Date dossier])"
    ActiveWorkbook.Worksheets("05_Mai").Range("E12").FormulaLocal = "=MOIS([Date dossier])"
    ActiveWorkbook.Worksheets("05_Mai").Range("F12").FormulaLocal = "=JOUR([Date dossier])"
    ActiveWorkbook.Worksheets("05_Mai").Range("G12").Value = TextBox3.Value
    ActiveWorkbook.Worksheets("05_Mai").Range("H12").Value = UCase(TextBox4.Value)
    ActiveWorkbook.Worksheets("05_Mai").Range("I12").Value = TextBox5.Value
    ActiveWorkbook.Worksheets("05_Mai").Range("J12").Value = TextBox6.Value
    ActiveWorkbook.Worksheets("05_Mai").Range("K12").Value = ComboBox1.Value
    ActiveWorkbook.Worksheets("05_Mai").Range("L12").Value = Type_temp
    ActiveWorkbook.Worksheets("05_Mai").Range("M12").Value = Dublin_temp
    ActiveWorkbook.Worksheets("05_Mai").Range("N12").Value = Nationalite_temp
    ActiveWorkbook.Worksheets("05_Mai").Range("O12").Value = Legitimite_temp
    ActiveWorkbook.Worksheets("05_Mai").Range("P12").Value = Validite_temp
    ActiveWorkbook.Worksheets("05_Mai").Range("Q12").Value = Lieu_temp
    ActiveWorkbook.Worksheets("05_Mai").Range("R12").Value = Remarques
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
    Unload Userform_patienter
    UserForm_operationsucces.Show
    Exit Sub
    Else
    DerLign = ActiveWorkbook.Worksheets("05_Mai").Range("A" & Rows.Count).End(xlUp).Row + 1
    ActiveWorkbook.Worksheets("05_Mai").Unprotect
    ActiveWorkbook.Worksheets("05_Mai").Range("B" & DerLign).Value = TextBox1.Value
    ActiveWorkbook.Worksheets("05_Mai").Range("C" & DerLign).Value = TextBox2.Value
    ActiveWorkbook.Worksheets("05_Mai").Range("D" & DerLign).FormulaLocal = "=ANNEE([Date dossier])"
    ActiveWorkbook.Worksheets("05_Mai").Range("E" & DerLign).FormulaLocal = "=MOIS([Date dossier])"
    ActiveWorkbook.Worksheets("05_Mai").Range("F" & DerLign).FormulaLocal = "=JOUR([Date dossier])"
    ActiveWorkbook.Worksheets("05_Mai").Range("G" & DerLign).Value = TextBox3.Value
    ActiveWorkbook.Worksheets("05_Mai").Range("H" & DerLign).Value = UCase(TextBox4.Value)
    ActiveWorkbook.Worksheets("05_Mai").Range("I" & DerLign).Value = TextBox5.Value
    ActiveWorkbook.Worksheets("05_Mai").Range("J" & DerLign).Value = TextBox6.Value
    ActiveWorkbook.Worksheets("05_Mai").Range("K" & DerLign).Value = ComboBox1.Value
    ActiveWorkbook.Worksheets("05_Mai").Range("L" & DerLign).Value = Type_temp
    ActiveWorkbook.Worksheets("05_Mai").Range("M" & DerLign).Value = Dublin_temp
    ActiveWorkbook.Worksheets("05_Mai").Range("N" & DerLign).Value = Nationalite_temp
    ActiveWorkbook.Worksheets("05_Mai").Range("O" & DerLign).Value = Legitimite_temp
    ActiveWorkbook.Worksheets("05_Mai").Range("P" & DerLign).Value = Validite_temp
    ActiveWorkbook.Worksheets("05_Mai").Range("Q" & DerLign).Value = Lieu_temp
    ActiveWorkbook.Worksheets("05_Mai").Range("R" & DerLign).Value = Remarques
     
       ActiveWorkbook.Worksheets("05_Mai").ListObjects("T_Mai").Sort.SortFields.Clear
        ActiveWorkbook.Worksheets("05_Mai").ListObjects("T_Mai").Sort.SortFields.Add _
            Key:=Range("T_Mai[Date dossier]"), SortOn:=xlSortOnValues, Order:= _
            xlAscending, DataOption:=xlSortTextAsNumbers
        ActiveWorkbook.Worksheets("05_Mai").ListObjects("T_Mai").Sort.SortFields.Add _
            Key:=Range("T_Mai[Nom]"), SortOn:=xlSortOnValues, Order:=xlAscending, _
            DataOption:=xlSortNormal
        ActiveWorkbook.Worksheets("05_Mai").ListObjects("T_Mai").Sort.SortFields.Add _
            Key:=Range("T_Mai[Prénom]"), SortOn:=xlSortOnValues, Order:=xlAscending, _
            DataOption:=xlSortNormal
        With ActiveWorkbook.Worksheets("05_Mai").ListObjects("T_Mai").Sort
            .Header = xlYes
            .MatchCase = False
            .Orientation = xlTopToBottom
            .SortMethod = xlPinYin
            .Apply
        End With
    ActiveWorkbook.Worksheets("05_Mai").Protect DrawingObjects:=False
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
    Unload Userform_patienter
    UserForm_operationsucces.Show
    Exit Sub
    End If
    End If
     
    If ComboBox1.Value = "Non" And TextBox7.Value = "6" Then
     
    If ActiveWorkbook.Worksheets("06_Juin").Range("F12").Value = "" Then
    ActiveWorkbook.Worksheets("06_Juin").Unprotect
    ActiveWorkbook.Worksheets("06_Juin").Range("B12").Value = TextBox1.Value
    ActiveWorkbook.Worksheets("06_Juin").Range("C12").Value = TextBox2.Value
    ActiveWorkbook.Worksheets("06_Juin").Range("D12").FormulaLocal = "=ANNEE([Date dossier])"
    ActiveWorkbook.Worksheets("06_Juin").Range("E12").FormulaLocal = "=MOIS([Date dossier])"
    ActiveWorkbook.Worksheets("06_Juin").Range("F12").FormulaLocal = "=JOUR([Date dossier])"
    ActiveWorkbook.Worksheets("06_Juin").Range("G12").Value = TextBox3.Value
    ActiveWorkbook.Worksheets("06_Juin").Range("H12").Value = UCase(TextBox4.Value)
    ActiveWorkbook.Worksheets("06_Juin").Range("I12").Value = TextBox5.Value
    ActiveWorkbook.Worksheets("06_Juin").Range("J12").Value = TextBox6.Value
    ActiveWorkbook.Worksheets("06_Juin").Range("K12").Value = ComboBox1.Value
    ActiveWorkbook.Worksheets("06_Juin").Range("L12").Value = Type_temp
    ActiveWorkbook.Worksheets("06_Juin").Range("M12").Value = Dublin_temp
    ActiveWorkbook.Worksheets("06_Juin").Range("N12").Value = Nationalite_temp
    ActiveWorkbook.Worksheets("06_Juin").Range("O12").Value = Legitimite_temp
    ActiveWorkbook.Worksheets("06_Juin").Range("P12").Value = Validite_temp
    ActiveWorkbook.Worksheets("06_Juin").Range("Q12").Value = Lieu_temp
    ActiveWorkbook.Worksheets("06_Juin").Range("R12").Value = Remarques
    ActiveWorkbook.Worksheets("06_Juin").Protect DrawingObjects:=False
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
    Unload Userform_patienter
    UserForm_operationsucces.Show
    Exit Sub
    Else
    DerLign = ActiveWorkbook.Worksheets("06_Juin").Range("A" & Rows.Count).End(xlUp).Row + 1
    ActiveWorkbook.Worksheets("06_Juin").Unprotect
    ActiveWorkbook.Worksheets("06_Juin").Range("B" & DerLign).Value = TextBox1.Value
    ActiveWorkbook.Worksheets("06_Juin").Range("C" & DerLign).Value = TextBox2.Value
    ActiveWorkbook.Worksheets("06_Juin").Range("D" & DerLign).FormulaLocal = "=ANNEE([Date dossier])"
    ActiveWorkbook.Worksheets("06_Juin").Range("E" & DerLign).FormulaLocal = "=MOIS([Date dossier])"
    ActiveWorkbook.Worksheets("06_Juin").Range("F" & DerLign).FormulaLocal = "=JOUR([Date dossier])"
    ActiveWorkbook.Worksheets("06_Juin").Range("G" & DerLign).Value = TextBox3.Value
    ActiveWorkbook.Worksheets("06_Juin").Range("H" & DerLign).Value = UCase(TextBox4.Value)
    ActiveWorkbook.Worksheets("06_Juin").Range("I" & DerLign).Value = TextBox5.Value
    ActiveWorkbook.Worksheets("06_Juin").Range("J" & DerLign).Value = TextBox6.Value
    ActiveWorkbook.Worksheets("06_Juin").Range("K" & DerLign).Value = ComboBox1.Value
    ActiveWorkbook.Worksheets("06_Juin").Range("M" & DerLign).Value = Dublin_temp
    ActiveWorkbook.Worksheets("06_Juin").Range("N" & DerLign).Value = Nationalite_temp
    ActiveWorkbook.Worksheets("06_Juin").Range("O" & DerLign).Value = Legitimite_temp
    ActiveWorkbook.Worksheets("06_Juin").Range("P" & DerLign).Value = Validite_temp
    ActiveWorkbook.Worksheets("06_Juin").Range("Q" & DerLign).Value = Lieu_temp
    ActiveWorkbook.Worksheets("06_Juin").Range("R" & DerLign).Value = Remarques
     
        ActiveWorkbook.Worksheets("06_Juin").ListObjects("T_Juin").Sort.SortFields. _
            Clear
        ActiveWorkbook.Worksheets("06_Juin").ListObjects("T_Juin").Sort.SortFields.Add _
            Key:=Range("T_Juin[Date dossier]"), SortOn:=xlSortOnValues, Order:= _
            xlAscending, DataOption:=xlSortTextAsNumbers
        ActiveWorkbook.Worksheets("06_Juin").ListObjects("T_Juin").Sort.SortFields.Add _
            Key:=Range("T_Juin[Nom]"), SortOn:=xlSortOnValues, Order:=xlAscending, _
            DataOption:=xlSortNormal
        ActiveWorkbook.Worksheets("06_Juin").ListObjects("T_Juin").Sort.SortFields.Add _
            Key:=Range("T_Juin[Prénom]"), SortOn:=xlSortOnValues, Order:=xlAscending _
            , DataOption:=xlSortNormal
        With ActiveWorkbook.Worksheets("06_Juin").ListObjects("T_Juin").Sort
            .Header = xlYes
            .MatchCase = False
            .Orientation = xlTopToBottom
            .SortMethod = xlPinYin
            .Apply
        End With
     
    ActiveWorkbook.Worksheets("06_Juin").Protect DrawingObjects:=False
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
    Unload Userform_patienter
    UserForm_operationsucces.Show
    Exit Sub
    End If
    End If
     
    If ComboBox1.Value = "Non" And TextBox7.Value = "7" Then
     
    If ActiveWorkbook.Worksheets("07_Juillet").Range("F12").Value = "" Then
    ActiveWorkbook.Worksheets("07_Juillet").Unprotect
    ActiveWorkbook.Worksheets("07_Juillet").Range("B12").Value = TextBox1.Value
    ActiveWorkbook.Worksheets("07_Juillet").Range("C12").Value = TextBox2.Value
    ActiveWorkbook.Worksheets("07_Juillet").Range("D12").FormulaLocal = "=ANNEE([Date dossier])"
    ActiveWorkbook.Worksheets("07_Juillet").Range("E12").FormulaLocal = "=MOIS([Date dossier])"
    ActiveWorkbook.Worksheets("07_Juillet").Range("F12").FormulaLocal = "=JOUR([Date dossier])"
    ActiveWorkbook.Worksheets("07_Juillet").Range("G12").Value = TextBox3.Value
    ActiveWorkbook.Worksheets("07_Juillet").Range("H12").Value = UCase(TextBox4.Value)
    ActiveWorkbook.Worksheets("07_Juillet").Range("I12").Value = TextBox5.Value
    ActiveWorkbook.Worksheets("07_Juillet").Range("J12").Value = TextBox6.Value
    ActiveWorkbook.Worksheets("07_Juillet").Range("K12").Value = ComboBox1.Value
    ActiveWorkbook.Worksheets("07_Juillet").Range("L12").Value = Type_temp
    ActiveWorkbook.Worksheets("07_Juillet").Range("M12").Value = Dublin_temp
    ActiveWorkbook.Worksheets("07_Juillet").Range("N12").Value = Nationalite_temp
    ActiveWorkbook.Worksheets("07_Juillet").Range("O12").Value = Legitimite_temp
    ActiveWorkbook.Worksheets("07_Juillet").Range("P12").Value = Validite_temp
    ActiveWorkbook.Worksheets("07_Juillet").Range("Q12").Value = Lieu_temp
    ActiveWorkbook.Worksheets("07_Juillet").Range("R12").Value = Remarques
    ActiveWorkbook.Worksheets("07_Juillet").Protect DrawingObjects:=False
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
    Unload Userform_patienter
    UserForm_operationsucces.Show
    Exit Sub
    Else
    DerLign = ActiveWorkbook.Worksheets("07_Juillet").Range("A" & Rows.Count).End(xlUp).Row + 1
    ActiveWorkbook.Worksheets("07_Juillet").Unprotect
    ActiveWorkbook.Worksheets("07_Juillet").Range("B" & DerLign).Value = TextBox1.Value
    ActiveWorkbook.Worksheets("07_Juillet").Range("C" & DerLign).Value = TextBox2.Value
    ActiveWorkbook.Worksheets("07_Juillet").Range("D" & DerLign).FormulaLocal = "=ANNEE([Date dossier])"
    ActiveWorkbook.Worksheets("07_Juillet").Range("E" & DerLign).FormulaLocal = "=MOIS([Date dossier])"
    ActiveWorkbook.Worksheets("07_juillet").Range("F" & DerLign).FormulaLocal = "=JOUR([Date dossier])"
    ActiveWorkbook.Worksheets("07_Juillet").Range("G" & DerLign).Value = TextBox3.Value
    ActiveWorkbook.Worksheets("07_Juillet").Range("H" & DerLign).Value = UCase(TextBox4.Value)
    ActiveWorkbook.Worksheets("07_Juillet").Range("I" & DerLign).Value = TextBox5.Value
    ActiveWorkbook.Worksheets("07_Juillet").Range("J" & DerLign).Value = TextBox6.Value
    ActiveWorkbook.Worksheets("07_Juillet").Range("K" & DerLign).Value = ComboBox1.Value
    ActiveWorkbook.Worksheets("07_Juillet").Range("M" & DerLign).Value = Dublin_temp
    ActiveWorkbook.Worksheets("07_Juillet").Range("N" & DerLign).Value = Nationalite_temp
    ActiveWorkbook.Worksheets("07_Juillet").Range("O" & DerLign).Value = Legitimite_temp
    ActiveWorkbook.Worksheets("07_Juillet").Range("P" & DerLign).Value = Validite_temp
    ActiveWorkbook.Worksheets("07_Juillet").Range("Q" & DerLign).Value = Lieu_temp
    ActiveWorkbook.Worksheets("07_Juillet").Range("R" & DerLign).Value = Remarques
     
      ActiveWorkbook.Worksheets("07_Juillet").ListObjects("T_Juillet").Sort. _
            SortFields.Clear
        ActiveWorkbook.Worksheets("07_Juillet").ListObjects("T_Juillet").Sort. _
            SortFields.Add Key:=Range("T_Juillet[Date dossier]"), SortOn:= _
            xlSortOnValues, Order:=xlAscending, DataOption:=xlSortTextAsNumbers
        ActiveWorkbook.Worksheets("07_Juillet").ListObjects("T_Juillet").Sort. _
            SortFields.Add Key:=Range("T_Juillet[Nom]"), SortOn:=xlSortOnValues, Order _
            :=xlAscending, DataOption:=xlSortNormal
        ActiveWorkbook.Worksheets("07_Juillet").ListObjects("T_Juillet").Sort. _
            SortFields.Add Key:=Range("T_Juillet[Prénom]"), SortOn:=xlSortOnValues, _
            Order:=xlAscending, DataOption:=xlSortNormal
        With ActiveWorkbook.Worksheets("07_Juillet").ListObjects("T_Juillet").Sort
            .Header = xlYes
            .MatchCase = False
            .Orientation = xlTopToBottom
            .SortMethod = xlPinYin
            .Apply
        End With
     
    ActiveWorkbook.Worksheets("07_Juillet").Protect DrawingObjects:=False
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
    Unload Userform_patienter
    UserForm_operationsucces.Show
    Exit Sub
    End If
    End If
     
    End Sub
    Je n'ai pas encore testé en profondeur mon code mais jusqu'à présent, il fonctionne très bien. Je souhaitais juste l'alléger afin que si des instructions sont ne sont pas nécessaires, il passe aux instructions suivantes.

    En espérant avoir été clair, je vous souhaite une bonne journée.

    JORDAN M.

  11. #11
    Inactif  

    Homme Profil pro
    cuisiniste
    Inscrit en
    Avril 2009
    Messages
    15 379
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : cuisiniste
    Secteur : Bâtiment

    Informations forums :
    Inscription : Avril 2009
    Messages : 15 379
    Points : 12 075
    Points
    12 075
    Billets dans le blog
    8
    Par défaut re
    re
    sinon une idéee un peu tordues comme je les aimes
    faire un replace provisoire et recupérer les rows des target modifiés dans une variable en publique
    exemple
    a supposer que je cherche les "aa" dans le range A110
    je vais donc faire ceci

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    Public lig
    Sub test()
    lig = ""
    r = ActiveSheet.Range("A1:D10").Cells.Replace("aa", "bb")
    MsgBox lig
    End Sub
    la tu va me dire mais a quel moment lig est instruit
    ben je te répond dans l'évènement change du worksheets
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    Private Sub Worksheet_Change(ByVal Target As Range)
    lig = lig & Target.Row & ","
    End Sub
    il ne reste plus qu'a faire l'inverse pour tout remettre en bloquant les évents
    je sais c'est tordu mais efficace

    attention quand même ca fonctionne pour les valeur entiers si tu a "djvndfjkvfdjaadfkvdjkv" ca sera pris en compte

    c'est Ryu qui va apprécier l'astuce
    mes fichiers dans les contributions:
    mail avec CDO en vba et mail avec CDO en vbs dans un HTA
    survol des bouton dans userform
    prendre un cliché d'un range

    si ton problème est résolu n'oublie pas de pointer : : ça peut servir aux autres
    et n'oublie pas de voter

  12. #12
    Inactif  

    Homme Profil pro
    cuisiniste
    Inscrit en
    Avril 2009
    Messages
    15 379
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : cuisiniste
    Secteur : Bâtiment

    Informations forums :
    Inscription : Avril 2009
    Messages : 15 379
    Points : 12 075
    Points
    12 075
    Billets dans le blog
    8
    Par défaut re
    pour etre exact comme ceci

    je cherche les "aa" dans la plage "A110"
    le msgbox va t'afficher les lignes concernées
    dans un module standard
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    Public lig
    Sub test()
    lig = ""
    r = ActiveSheet.Range("A1:D10").Cells.Replace("aa", "bb")
    Application.EnableEvents = False
    r = ActiveSheet.Range("A1:D10").Cells.Replace("bb", "aa")
    MsgBox lig
    Application.EnableEvents = True
    End Sub
    dans lemodule du sheets concerné
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    Private Sub Worksheet_Change(ByVal Target As Range)
    lig = lig & Target.Row & ","
    End Sub
    demo
    Nom : demo4.gif
Affichages : 690
Taille : 305,0 Ko
    mes fichiers dans les contributions:
    mail avec CDO en vba et mail avec CDO en vbs dans un HTA
    survol des bouton dans userform
    prendre un cliché d'un range

    si ton problème est résolu n'oublie pas de pointer : : ça peut servir aux autres
    et n'oublie pas de voter

  13. #13
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    118
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Avril 2010
    Messages : 118
    Points : 76
    Points
    76
    Par défaut Sortir d'un For
    Hello,

    Merci pour ta réponse. C'est effectivement un peu tordu et si je comprends bien, il me semble pas que cela soit la bonne méthode pour mon cas.

    J pense m'être mal exprimé. Mon code fonctionne bien mais je souhaite juste sortir de la boucle for quand code1=code2 😌 Afin qu'il ne poursuive pas inutilement sur le reste de mon tableau car je sais que les données ne sont présentes qu'une seule fois.

    Excellente journée.

    Jordan M.

  14. #14
    Rédacteur
    Avatar de Philippe Tulliez
    Homme Profil pro
    Formateur, développeur et consultant Excel, Access, Word et VBA
    Inscrit en
    Janvier 2010
    Messages
    12 781
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Formateur, développeur et consultant Excel, Access, Word et VBA

    Informations forums :
    Inscription : Janvier 2010
    Messages : 12 781
    Points : 28 648
    Points
    28 648
    Billets dans le blog
    53
    Par défaut
    Bonjour,
    Ce n'est tout de même pas compliqué. Tu dois placer Exit For comme dernière instruction dans la structure conditionnelle If
    Exemple
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    Sub t()
     Dim x As Integer
     For x = 1 To 100
      If x = 20 Then
       MsgBox "je quitte la boucle à " & x
       Exit For
      End If
     Next
    End Sub
    Ceci dit, puisque tu es certain que les cellules identiques ne se retrouvent qu'une seule fois dans la liste d edonnées, la solution que t'avait proposé RyuAutodidacte au fil #2 est parfaite et ne nécessite pas de code VBA
    Philippe Tulliez
    Ce que l'on conçoit bien s'énonce clairement, et les mots pour le dire arrivent aisément. (Nicolas Boileau)
    Lorsque vous avez la réponse à votre question, n'oubliez pas de cliquer sur et si celle-ci est pertinente pensez à voter
    Mes tutoriels : Utilisation de l'assistant « Insertion de fonction », Les filtres avancés ou élaborés dans Excel
    Mon dernier billet : Utilisation de la fonction Dir en VBA pour vérifier l'existence d'un fichier

  15. #15
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    118
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Avril 2010
    Messages : 118
    Points : 76
    Points
    76
    Par défaut Exit For
    Bonsoir,

    Veuillez m'excuser, je dois être fatigué en cette fin de semaine. Lorsque je faisais mes essais, impossible de faire fonctionner Exit For. En le plaçant à différents endroits, j'obtenais à chaque fois des messages d'erreur (bloc end if sans if, next sans for etc...) et je n'arrivai point a le placer correctement malgré que cela soit une condition que j'utilise correctement. Tout est réglé avec le code ci-dessous, cela fonctionne parfaitement. Merci pour votre aide.

    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
    If Sortie_temp = "Non" And Mois_temp = "5" Then
    If Sortie_temp <> ComboBox1.Value Then
    With Sheets("Suivi dossiers personnels")
    code1 = .Range("A" & ActiveCell.Row) & .Range("B" & ActiveCell.Row) & .Range("C" & ActiveCell.Row) & .Range("D" & ActiveCell.Row) & .Range("E" & ActiveCell.Row) & _
        .Range("F" & ActiveCell.Row) & .Range("G" & ActiveCell.Row) & .Range("H" & ActiveCell.Row) & .Range("I" & ActiveCell.Row) & .Range("J" & ActiveCell.Row)
    End With
    ActiveWorkbook.Worksheets("05_Mai").Unprotect
    With Sheets("05_Mai")
     For j = Range("B" & Rows.Count).End(xlUp).Row To 12 Step -1
            code2 = .Range("B" & j) & .Range("C" & j) & .Range("D" & j) & .Range("E" & j) & .Range("F" & j) & _
        .Range("G" & j) & .Range("H" & j) & .Range("I" & j) & .Range("J" & j) & .Range("K" & j)
            If code2 = code1 Then
    Type_temp = ActiveWorkbook.Worksheets("05_Mai").Range("L" & j)
    Dublin_temp = ActiveWorkbook.Worksheets("05_Mai").Range("M" & j)
    Nationalite_temp = ActiveWorkbook.Worksheets("05_Mai").Range("N" & j).Value
    Legitimite_temp = ActiveWorkbook.Worksheets("05_Mai").Range("O" & j).Value
    Validite_temp = ActiveWorkbook.Worksheets("05_Mai").Range("P" & j).Value
    Remarques_temp = ActiveWorkbook.Worksheets("05_Mai").Range("R" & j).Value
    .Rows(j).Delete
    Exit For
    End If
        Next j
    End With
    Else
    With Sheets("Suivi dossiers personnels")
    code1 = .Range("A" & ActiveCell.Row) & .Range("B" & ActiveCell.Row) & .Range("C" & ActiveCell.Row) & .Range("D" & ActiveCell.Row) & .Range("E" & ActiveCell.Row) & _
        .Range("F" & ActiveCell.Row) & .Range("G" & ActiveCell.Row) & .Range("H" & ActiveCell.Row) & .Range("I" & ActiveCell.Row) & .Range("J" & ActiveCell.Row)
    End With
    ActiveWorkbook.Worksheets("05_Mai").Unprotect
    With Sheets("05_Mai")
     For j = Range("B" & Rows.Count).End(xlUp).Row To 12 Step -1
            code2 = .Range("B" & j) & .Range("C" & j) & .Range("D" & j) & .Range("E" & j) & .Range("F" & j) & _
        .Range("G" & j) & .Range("H" & j) & .Range("I" & j) & .Range("J" & j) & .Range("K" & j)
            If code2 = code1 Then
    Type_temp = ActiveWorkbook.Worksheets("05_Mai").Range("L" & j)
    Dublin_temp = ActiveWorkbook.Worksheets("05_Mai").Range("M" & j)
    Nationalite_temp = ActiveWorkbook.Worksheets("05_Mai").Range("N" & j).Value
    Legitimite_temp = ActiveWorkbook.Worksheets("05_Mai").Range("O" & j).Value
    Validite_temp = ActiveWorkbook.Worksheets("05_Mai").Range("P" & j).Value
    Lieu_temp = ActiveWorkbook.Worksheets("05_Mai").Range("Q" & j).Value
    Remarques_temp = ActiveWorkbook.Worksheets("05_Mai").Range("R" & j).Value
    .Rows(j).Delete
    Exit For
    End If
        Next j
    End With
    End If
    End If
    Excellente soirée et bon weekend.

    JORDAN M.

  16. #16
    Expert confirmé
    Homme Profil pro
    PAO
    Inscrit en
    Octobre 2014
    Messages
    2 576
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : PAO
    Secteur : Communication - Médias

    Informations forums :
    Inscription : Octobre 2014
    Messages : 2 576
    Points : 4 174
    Points
    4 174
    Par défaut
    Bonsoir,

    Vu le nombre de ligne en post #10 je comprends que tu n'est pas voulu l'affiché, oui ça fait peur
    Comme quoi on ne le dira jamais assez, une très bonne explication claire et exhaustive avec les tenants et aboutissants et le but final vaut mieux que des centaines de lignes … !

    donc j'ai juste survolé rapidement le code (1 mn), et je vois qu'il y a pas mal de répétitions
    je dirais pas vraiment que c'est résolu vu le nombre de lignes

    Ne connaissant pas ta gestion des données réellement je vais juste te donner un exemple qui est du grosso modo mais vers quoi on pourrait se rapprocher (Ne pas oublier les déclarations de variables - remplacer les "?"):
    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
    Sub Exemple()
    Dim L&, DL&, Maligne&, F1$, F2$
    'Dim Type_temp as ?, Dublin_temp as ?, Nationalite_temp as ?, Legitimite_temp as ?, Validite_temp as ?, Remarques_temp as ?, Remarques_temp as ?
     
        L = ActiveCell.Row
        F1 = "Suivi dossiers personnels"
        F2 = "NomDeLaFeuilleSelonCondition"
        DL = Sheets(F2).Cells(Rows.Count, 1).End(xlUp).Row
     
        'MaLigne = Evaluate("SUMPRODUCT((Feuil2!$A$1:$A$30=Feuil1!$A1)*(Feuil2!$B$1:$B$30=Feuil1!$B1)*(Feuil2!$C$1:$C$30=$C1)*(Feuil2!$D$1:$D$30=Feuil1!$D1)*ROW(Feuil2!$A$1:$D$30))")
        Maligne = Evaluate("SUMPRODUCT((" & F2 & "!$A$1:$A$" & DL & "=" & F1 & "!$A" & L & ")*(" & F2 & "!$B$1:$B$" & DL & "=" & F1 & "!$B" & L & ")*(" & F2 & "!$C$1:$C$" & DL & "=" & F1 & "!$C" & L & ")*(" & F2 & "!$D$1:$D$" & DL & "=" & F1 & "!$D" & L & ")*ROW(" & F2 & "!$A$1:$D$" & DL & "))")
        'MaLigne correspond en tout point à la formule "SUMPRODUCT" sauf qu'ici dans le code elle s'adapte automatiquement et il n'y a point besoin de boucle
     
        If Maligne = 0 Then
            MsgBox "Dossier non trouvé": Exit Sub
        Else
            With Sheets(F2)
                Type_temp = .Range("L" & Maligne).Value
                Dublin_temp = .Range("M" & Maligne).Value
                Nationalite_temp = .Range("N" & Maligne).Value
                Legitimite_temp = .Range("O" & Maligne).Value
                Validite_temp = .Range("P" & Maligne).Value
                Lieu_temp = .Range("Q" & Maligne).Value
                Remarques_temp = .Range("R" & Maligne).Value
                .Rows(Maligne).EntireRow.Delete
            End With
        End If
    End Sub
    Afin de mieux voir
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    'MaLigne = Evaluate("SUMPRODUCT((Feuil2!$A$1:$A$30=Feuil1!$A1)*(Feuil2!$B$1:$B$30=Feuil1!$B1)*(Feuil2!$C$1:$C$30=$C1)*(Feuil2!$D$1:$D$30=Feuil1!$D1)*ROW(Feuil2!$A$1:$D$30))")
    Maligne = Evaluate("SUMPRODUCT((" & F2 & "!$A$1:$A$" & DL & "=" & F1 & "!$A" & L & ")" & _
                                 "*(" & F2 & "!$B$1:$B$" & DL & "=" & F1 & "!$B" & L & ")" & _
                                 "*(" & F2 & "!$C$1:$C$" & DL & "=" & F1 & "!$C" & L & ")" & _
                                 "*(" & F2 & "!$D$1:$D$" & DL & "=" & F1 & "!$D" & L & ")" & _
                                 "*ROW(" & F2 & "!$A$1:$D$" & DL & "))")
    Ici il ne s'agit pas de tester le code mais de comprendre le principe et ce que l'on peut faire avec des variables
    En tout cas avec tes plus de 500 lignes bonjour la maintenance …

    Coucou Patrick , je vois que ta pas changer t'arrive toujours à nous trouver un truc de tordu
    en tout cas ça marche, j'y repenserai le cas échéant
    Cordialement
    Ryu

    La connaissance s’acquiert par l’expérience, tout le reste n’est que de l’information. – Albert Einstein

    Pensez à la Balise [ CODE][/CODE ] - à utiliser via le bouton # => Exemple

    Une fois votre problème solutionné pensez à mettre en n'oubliant pas d'indiquer qu'elle est la solution finale choisie

  17. #17
    Inactif  

    Homme Profil pro
    cuisiniste
    Inscrit en
    Avril 2009
    Messages
    15 379
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : cuisiniste
    Secteur : Bâtiment

    Informations forums :
    Inscription : Avril 2009
    Messages : 15 379
    Points : 12 075
    Points
    12 075
    Billets dans le blog
    8
    Par défaut re
    bonjour RYU pourquoi voudrais tu que je change hein!!!
    n'empêche que ca marche et comme j'utilise les évènement Excel c'est même plus rapide
    ca reste limité tout de même au xlpart sauf chaine bien précise
    mes fichiers dans les contributions:
    mail avec CDO en vba et mail avec CDO en vbs dans un HTA
    survol des bouton dans userform
    prendre un cliché d'un range

    si ton problème est résolu n'oublie pas de pointer : : ça peut servir aux autres
    et n'oublie pas de voter

  18. #18
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    118
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Avril 2010
    Messages : 118
    Points : 76
    Points
    76
    Par défaut Mon code
    Bonsoir Ryu,

    Je te remercie pour ton post. Je t'avoue que je suis débutant en VBA Excel. J'ai développé deux-trois fichiers Excel pour mon utilisation à domicile (compta, gestion maison, etc...) qui fonctionne bien mais effectivement au niveau du code c'est du MacGiver.

    Cette fois-ci, c'est un fichier pour mon suivi de dossier pour le professionnel. Donc je ne souhaite pas faire du rafistolage. J'ai effectivement débuté avec les déclarations de variables que je ne faisais jamais avant mais je ne comprends pas encore tout. Je vais donc faire en sorte de "simplifier" et alléger mon code, c'est le but final. Je pense que vous ne tarderez pas à revoir un post de ma part car j'ai deja trop fait de code à "l'ancienne" et je ne sais pas du tout comment m'y prendre maintenant. 😂 Je vais toutefois me pencher encore quelques jours sur la question.

    Merci une fois de plus pour vos conseils à tous et votre aide.

    Excellente soirée.

    Jordan M.

  19. #19
    Expert confirmé
    Homme Profil pro
    PAO
    Inscrit en
    Octobre 2014
    Messages
    2 576
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : PAO
    Secteur : Communication - Médias

    Informations forums :
    Inscription : Octobre 2014
    Messages : 2 576
    Points : 4 174
    Points
    4 174
    Par défaut
    Bonsoir,

    J'ai effectivement débuté avec les déclarations de variables que je ne faisais jamais avant mais je ne comprends pas encore tout
    A lire absolument : Utiliser les variables en VBA Excel

    Je vais donc faire en sorte de "simplifier" et alléger mon code
    commence par repérer les schémas/actions répétitifs faisant quasiment la même chose même si parfois il peut y avoir de petites différences

    Sinon il est toujours bon de revoir sa copie afin de voir si on peut simplifier la manière de faire, aussi bien dans la structure des données que dans la façon de les traiter

    Sinon un exemple que l'on peut tester pour trouver la ligne - le code remodeler "F2" pourrait prendre le nom de n'importe quelles feuilles :
    Code à mettre dans la feuille 1 (pour la sélection de la ligne il faut double cliquer) :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
        lig = Target.Row
        msg = MsgBox("La ligne " & lig & " est sélectionné" & vbCrLf & "Est ce bien la ligne souhaitée ?", vbOKCancel)
        If msg = vbCancel Then lig = ""
        L = lig
        Cancel = True
        PourTester
    End Sub
    Code à mettre dans un module, le résultat se trouvant dans la fenêtre d'exécution :
    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
    Sub PourTester()
     
        If L = "" Then MsgBox "Sélectionner une ligne en double cliquant dessus": Feuil1.Activate: Exit Sub
     
        F1 = "Feuil1": F2 = "Feuil2" 'Mettre le nom des Feuilles
        'L = ActiveCell.Row:
        DL = Sheets(F2).Cells(Rows.Count, 1).End(xlUp).Row
     
        'MaLigne = Evaluate("SUMPRODUCT((Feuil2!$A$1:$A$30=Feuil1!$A1)*(Feuil2!$B$1:$B$30=Feuil1!$B1)*(Feuil2!$C$1:$C$30=$C1)*(Feuil2!$D$1:$D$30=Feuil1!$D1)*ROW(Feuil2!$A$1:$D$30))")
        Maligne = Evaluate("SUMPRODUCT((" & F2 & "!$A$1:$A$" & DL & "=" & F1 & "!$A" & L & ")" & _
                                     "*(" & F2 & "!$B$1:$B$" & DL & "=" & F1 & "!$B" & L & ")" & _
                                     "*(" & F2 & "!$C$1:$C$" & DL & "=" & F1 & "!$C" & L & ")" & _
                                     "*(" & F2 & "!$D$1:$D$" & DL & "=" & F1 & "!$D" & L & ")" & _
                                     "*ROW(" & F2 & "!$A$1:$D$" & DL & "))")
        If Maligne = 0 Then
            Debug.Print "Pas de dossier"
        Else
            Debug.Print "Dossier trouvé en ligne : " & Maligne
            With Sheets(F2)
                Debug.Print "Type_temp = " & .Range("L" & Maligne).Value & vbCrLf & _
                "Dublin_temp = " & .Range("M" & Maligne).Value & vbCrLf & _
                "Nationalite_temp = " & .Range("N" & Maligne).Value & vbCrLf & _
                "Legitimite_temp = " & .Range("O" & Maligne).Value & vbCrLf & _
                "Validite_temp = " & .Range("P" & Maligne).Value & vbCrLf & _
                "Lieu_temp = " & .Range("Q" & Maligne).Value & vbCrLf & _
                "Remarques_temp =" & .Range("R" & Maligne).Value
                '.Rows(Maligne).EntireRow.Delete
            End With
        End If
        L = ""
    End Sub
    PS : j'ai mis une sécurité pour la sélection de la ligne se trouvant à chaque fois sur la même feuille

    Edit : Patrick ne change rien c'est très bien comme ça …
    Cordialement
    Ryu

    La connaissance s’acquiert par l’expérience, tout le reste n’est que de l’information. – Albert Einstein

    Pensez à la Balise [ CODE][/CODE ] - à utiliser via le bouton # => Exemple

    Une fois votre problème solutionné pensez à mettre en n'oubliant pas d'indiquer qu'elle est la solution finale choisie

  20. #20
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    118
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Avril 2010
    Messages : 118
    Points : 76
    Points
    76
    Par défaut VBA Excel
    Bonjour Ryu,

    Je te remercie pour ton post. Je vais prendre le soin de lire attentivement ton lien et "d'étudier" ton code.

    Effectivement, j'ai beaucoup de schémas qui se répètent. J'ai déjà grandement simplifier le code en regroupant les actions répétitivent. J'ai "plus que" () 480 lignes de codes sur ce module mais au moins, je n'ai rien besoin d'ajouter contrairement à mon code précédent ou je ne traitais que 3 mois de l'année civile complète. Je vais tenté encore de regoruper des informations.

    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
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    Private Sub CommandButton2_Click()
     
    If TextBox3.Value = "" Or TextBox4.Value = "" Or TextBox5.Value = "" Or TextBox6.Value = "" Or ComboBox1.Value = "" Or ComboBox1.Value = "Oui" And ComboBox2.Value = "" Then
     
    If TextBox3.Value = "" Then Label6.ForeColor = &HFF&
    If TextBox3.Value <> "" Then Label6.ForeColor = &H80000012
    If TextBox4.Value = "" Then Label5.ForeColor = &HFF&
    If TextBox4.Value <> "" Then Label5.ForeColor = &H80000012
    If TextBox5.Value = "" Then Label4.ForeColor = &HFF&
    If TextBox5.Value <> "" Then Label4.ForeColor = &H80000012
    If TextBox6.Value = "" Then Label3.ForeColor = &HFF&
    If TextBox6.Value <> "" Then Label3.ForeColor = &H80000012
    If ComboBox1.Value = "" Then Label2.ForeColor = &HFF&
    If ComboBox1.Value <> "" Then Label2.ForeColor = &H80000012
    If ComboBox1.Value = "Oui" And ComboBox2.Value = "" Then Label9.ForeColor = &HFF&
    If ComboBox1.Value = "Oui" And ComboBox2.Value <> "" Then Label9.ForeColor = &H80000012
    UserForm_infochamps.Show
    Exit Sub
    End If
     
    Unload UserForm_modifier
    Userform_patienter.Show vbModeless
     
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
     
    ActiveWorkbook.Save
     
    DrLig = ActiveCell.Row
    Mois_temp = Range("D" & DrLig)
    Mois_temp_After = TextBox7.Value
    Sortie_temp = Range("J" & DrLig)
     
    If Mois_temp = "1" Then
    Moisdossier_temp = "01_Janvier"
    ElseIf Mois_temp = "2" Then
    Moisdossier_temp = "02_Février"
    ElseIf Mois_temp = "3" Then
    Moisdossier_temp = "03_Mars"
    ElseIf Mois_temp = "4" Then
    Moisdossier_temp = "04_Avril"
    ElseIf Mois_temp = "5" Then
    Moisdossier_temp = "05_Mai"
    ElseIf Mois_temp = "6" Then
    Moisdossier_temp = "06_Juin"
    ElseIf Mois_temp = "7" Then
    Moisdossier_temp = "07_Juillet"
    ElseIf Mois_temp = "8" Then
    Moisdossier_temp = "08_Août"
    ElseIf Mois_temp = "9" Then
    Moisdossier_temp = "09_Septembre"
    ElseIf Mois_temp = "10" Then
    Moisdossier_temp = "10_Octobre"
    ElseIf Mois_temp = "11" Then
    Moisdossier_temp = "11_Novembre"
    ElseIf Mois_temp = "12" Then
    Moisdossier_temp = "12_Décembre"
    End If
     
    If Mois_temp_After = "1" Then
    Moisdossier_temp_After = "01_Janvier"
    Tableau_temp = "T_Janvier"
    Tableau_locked = "T_Janvier[Statut]"
    Tableau_locked2 = "T_Janvier[[Type dossier]:[Remarques]]"
    Tableau_champ1 = "T_Janvier[Date dossier]"
    Tableau_champ2 = "T_Janvier[Nom]"
    Tableau_champ3 = "T_Janvier[Prénom]"
    ElseIf Mois_temp_After = "2" Then
    Moisdossier_temp_After = "02_Février"
    Tableau_temp = "T_Février"
    Tableau_locked = "T_Février[Statut]"
    Tableau_locked2 = "T_Février[[Type dossier]:[Remarques]]"
    Tableau_champ1 = "T_Février[Date dossier]"
    Tableau_champ2 = "T_Février[Nom]"
    Tableau_champ3 = "T_Février[Prénom]"
    ElseIf Mois_temp_After = "3" Then
    Moisdossier_temp_After = "03_Mars"
    Tableau_temp = "T_Mars"
    Tableau_locked = "T_Mars[Statut]"
    Tableau_locked2 = "T_Mars[[Type dossier]:[Remarques]]"
    Tableau_champ1 = "T_Mars[Date dossier]"
    Tableau_champ2 = "T_Mars[Nom]"
    Tableau_champ3 = "T_Mars[Prénom]"
    ElseIf Mois_temp_After = "4" Then
    Moisdossier_temp_After = "04_Avril"
    Tableau_temp = "T_Avril"
    Tableau_locked = "T_Avril[Statut]"
    Tableau_locked2 = "T_Avril[[Type dossier]:[Remarques]]"
    Tableau_champ1 = "T_Avril[Date dossier]"
    Tableau_champ2 = "T_Avril[Nom]"
    Tableau_champ3 = "T_Avril[Prénom]"
    ElseIf Mois_temp_After = "5" Then
    Moisdossier_temp_After = "05_Mai"
    Tableau_temp = "T_Mai"
    Tableau_locked = "T_Mai[Statut]"
    Tableau_locked2 = "T_Mai[[Type dossier]:[Remarques]]"
    Tableau_champ1 = "T_Mai[Date dossier]"
    Tableau_champ2 = "T_Mai[Nom]"
    Tableau_champ3 = "T_Mai[Prénom]"
    ElseIf Mois_temp_After = "6" Then
    Moisdossier_temp_After = "06_Juin"
    Tableau_temp = "T_Juin"
    Tableau_locked = "T_Juin[Statut]"
    Tableau_locked2 = "T_Juin[[Type dossier]:[Remarques]]"
    Tableau_champ1 = "T_Juin[Date dossier]"
    Tableau_champ2 = "T_Juin[Nom]"
    Tableau_champ3 = "T_Juin[Prénom]"
    ElseIf Mois_temp_After = "7" Then
    Moisdossier_temp_After = "07_Juillet"
    Tableau_temp = "T_Juillet"
    Tableau_locked = "T_Juillet[Statut]"
    Tableau_locked2 = "T_Juillet[[Type dossier]:[Remarques]]"
    Tableau_champ1 = "T_Juillet[Date dossier]"
    Tableau_champ2 = "T_Juillet[Nom]"
    Tableau_champ3 = "T_Juillet[Prénom]"
    ElseIf Mois_temp_After = "8" Then
    Moisdossier_temp_After = "08_Août"
    Tableau_temp = "T_Août"
    Tableau_locked = "T_Août[Statut]"
    Tableau_locked2 = "T_Août[[Type dossier]:[Remarques]]"
    Tableau_champ1 = "T_Août[Date dossier]"
    Tableau_champ2 = "T_Août[Nom]"
    Tableau_champ3 = "T_Août[Prénom]"
    ElseIf Mois_temp_After = "9" Then
    Moisdossier_temp_After = "09_Septembre"
    Tableau_temp = "T_Septembre"
    Tableau_locked = "T_Septembre[Statut]"
    Tableau_locked2 = "T_Septembre[[Type dossier]:[Remarques]]"
    Tableau_champ1 = "T_Septembre[Date dossier]"
    Tableau_champ2 = "T_Septembre[Nom]"
    Tableau_champ3 = "T_Septembre[Prénom]"
    ElseIf Mois_temp_After = "10" Then
    Moisdossier_temp_After = "10_Octobre"
    Tableau_temp = "T_Octobre"
    Tableau_locked = "T_Octobre[Statut]"
    Tableau_locked2 = "T_Octobre[[Type dossier]:[Remarques]]"
    Tableau_champ1 = "T_Octobre[Date dossier]"
    Tableau_champ2 = "T_Octobre[Nom]"
    Tableau_champ3 = "T_Octobre[Prénom]"
    ElseIf Mois_temp_After = "11" Then
    Moisdossier_temp_After = "11_Novembre"
    Tableau_temp = "T_Novembre"
    Tableau_locked = "T_Novembre[Statut]"
    Tableau_locked2 = "T_Novembre[[Type dossier]:[Remarques]]"
    Tableau_champ1 = "T_Novembre[Date dossier]"
    Tableau_champ2 = "T_Novembre[Nom]"
    Tableau_champ3 = "T_Novembre[Prénom]"
    ElseIf Mois_temp_After = "12" Then
    Moisdossier_temp_After = "12_Décembre"
    Tableau_temp = "T_Décembre"
    Tableau_locked = "T_Décembre[Statut]"
    Tableau_locked2 = "T_Décembre[[Type dossier]:[Remarques]]"
    Tableau_champ1 = "T_Décembre[Date dossier]"
    Tableau_champ2 = "T_Décembre[Nom]"
    Tableau_champ3 = "T_Décembre[Prénom]"
    End If
     
    If Sortie_temp = "Oui" Then
    If Sortie_temp <> ComboBox1.Value Then
    With Sheets("Suivi dossiers personnels")
    code1 = .Range("A" & ActiveCell.Row) & .Range("B" & ActiveCell.Row) & .Range("C" & ActiveCell.Row) & .Range("D" & ActiveCell.Row) & .Range("E" & ActiveCell.Row) & _
        .Range("F" & ActiveCell.Row) & .Range("G" & ActiveCell.Row) & .Range("H" & ActiveCell.Row) & .Range("I" & ActiveCell.Row) & .Range("J" & ActiveCell.Row)
    End With
    ActiveWorkbook.Worksheets("Sortie_prison").Unprotect
    With Sheets("Sortie_prison")
     For j = Range("B" & Rows.Count).End(xlUp).Row To 12 Step -1
            code2 = .Range("B" & j) & .Range("C" & j) & .Range("D" & j) & .Range("E" & j) & .Range("F" & j) & _
        .Range("G" & j) & .Range("H" & j) & .Range("I" & j) & .Range("J" & j) & .Range("K" & j)
            If code2 = code1 Then
    Type_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("M" & j)
    Dublin_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("N" & j)
    Nationalite_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("O" & j)
    Legitimite_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("P" & j)
    Validite_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("Q" & j)
    Remarques_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("W" & j)
    .Rows(j).EntireRow.Delete
    Exit For
    End If
        Next j
    End With
    ActiveWorkbook.Worksheets("Sortie_prison").Protect DrawingObjects:=False
    Else
    With Sheets("Suivi dossiers personnels")
    code1 = .Range("A" & ActiveCell.Row) & .Range("B" & ActiveCell.Row) & .Range("C" & ActiveCell.Row) & .Range("D" & ActiveCell.Row) & .Range("E" & ActiveCell.Row) & _
        .Range("F" & ActiveCell.Row) & .Range("G" & ActiveCell.Row) & .Range("H" & ActiveCell.Row) & .Range("I" & ActiveCell.Row) & .Range("J" & ActiveCell.Row)
    End With
    ActiveWorkbook.Worksheets("Sortie_prison").Unprotect
    With Sheets("Sortie_prison")
     For j = Range("B" & Rows.Count).End(xlUp).Row To 12 Step -1
            code2 = .Range("B" & j) & .Range("C" & j) & .Range("D" & j) & .Range("E" & j) & .Range("F" & j) & _
        .Range("G" & j) & .Range("H" & j) & .Range("I" & j) & .Range("J" & j) & .Range("K" & j)
            If code2 = code1 Then
    Type_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("M" & j)
    Dublin_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("N" & j)
    Nationalite_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("O" & j)
    Legitimite_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("P" & j)
    Validite_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("Q" & j)
    Dateentree_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("R" & j)
    Date23_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("S" & j)
    Datesortie_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("U" & j)
    Remarques_temp = ActiveWorkbook.Worksheets("Sortie_prison").Range("W" & j)
    .Rows(j).EntireRow.Delete
    Exit For
    End If
        Next j
    End With
    ActiveWorkbook.Worksheets("Sortie_prison").Protect DrawingObjects:=False
    End If
    End If
     
    If Sortie_temp = "Non" Then
    If Sortie_temp <> ComboBox1.Value Then
    With Sheets("Suivi dossiers personnels")
    code1 = .Range("A" & ActiveCell.Row) & .Range("B" & ActiveCell.Row) & .Range("C" & ActiveCell.Row) & .Range("D" & ActiveCell.Row) & .Range("E" & ActiveCell.Row) & _
        .Range("F" & ActiveCell.Row) & .Range("G" & ActiveCell.Row) & .Range("H" & ActiveCell.Row) & .Range("I" & ActiveCell.Row) & .Range("J" & ActiveCell.Row)
    End With
    ActiveWorkbook.Worksheets(Moisdossier_temp).Unprotect
    With Sheets(Moisdossier_temp)
     For j = Range("B" & Rows.Count).End(xlUp).Row To 12 Step -1
            code2 = .Range("B" & j) & .Range("C" & j) & .Range("D" & j) & .Range("E" & j) & .Range("F" & j) & _
        .Range("G" & j) & .Range("H" & j) & .Range("I" & j) & .Range("J" & j) & .Range("K" & j)
            If code2 = code1 Then
    Type_temp = ActiveWorkbook.Worksheets(Moisdossier_temp).Range("L" & j)
    Dublin_temp = ActiveWorkbook.Worksheets(Moisdossier_temp).Range("M" & j)
    Nationalite_temp = ActiveWorkbook.Worksheets(Moisdossier_temp).Range("N" & j).Value
    Legitimite_temp = ActiveWorkbook.Worksheets(Moisdossier_temp).Range("O" & j).Value
    Validite_temp = ActiveWorkbook.Worksheets(Moisdossier_temp).Range("P" & j).Value
    Remarques_temp = ActiveWorkbook.Worksheets(Moisdossier_temp).Range("R" & j).Value
    .Rows(j).EntireRow.Delete
    Exit For
    End If
        Next j
    End With
    ActiveWorkbook.Worksheets(Moisdossier_temp).Protect DrawingObjects:=False
    Else
    With Sheets("Suivi dossiers personnels")
    code1 = .Range("A" & ActiveCell.Row) & .Range("B" & ActiveCell.Row) & .Range("C" & ActiveCell.Row) & .Range("D" & ActiveCell.Row) & .Range("E" & ActiveCell.Row) & _
        .Range("F" & ActiveCell.Row) & .Range("G" & ActiveCell.Row) & .Range("H" & ActiveCell.Row) & .Range("I" & ActiveCell.Row) & .Range("J" & ActiveCell.Row)
    End With
    ActiveWorkbook.Worksheets(Moisdossier_temp).Unprotect
    With Sheets(Moisdossier_temp)
     For j = Range("B" & Rows.Count).End(xlUp).Row To 12 Step -1
            code2 = .Range("B" & j) & .Range("C" & j) & .Range("D" & j) & .Range("E" & j) & .Range("F" & j) & _
        .Range("G" & j) & .Range("H" & j) & .Range("I" & j) & .Range("J" & j) & .Range("K" & j)
            If code2 = code1 Then
    Type_temp = ActiveWorkbook.Worksheets(Moisdossier_temp).Range("L" & j)
    Dublin_temp = ActiveWorkbook.Worksheets(Moisdossier_temp).Range("M" & j)
    Nationalite_temp = ActiveWorkbook.Worksheets(Moisdossier_temp).Range("N" & j).Value
    Legitimite_temp = ActiveWorkbook.Worksheets(Moisdossier_temp).Range("O" & j).Value
    Validite_temp = ActiveWorkbook.Worksheets(Moisdossier_temp).Range("P" & j).Value
    Lieu_temp = ActiveWorkbook.Worksheets(Moisdossier_temp).Range("Q" & j).Value
    Remarques_temp = ActiveWorkbook.Worksheets(Moisdossier_temp).Range("R" & j).Value
    .Rows(j).EntireRow.Delete
    Exit For
    End If
        Next j
    End With
    ActiveWorkbook.Worksheets(Moisdossier_temp).Protect DrawingObjects:=False
    End If
    End If
     
    ActiveWorkbook.Worksheets("Suivi dossiers personnels").Unprotect
    ActiveWorkbook.Worksheets("Suivi dossiers personnels").Range("A" & DrLig).Value = TextBox1.Value
    ActiveWorkbook.Worksheets("Suivi dossiers personnels").Range("B" & DrLig).Value = TextBox2.Value
    ActiveWorkbook.Worksheets("Suivi dossiers personnels").Range("F" & DrLig).Value = TextBox3.Value
    ActiveWorkbook.Worksheets("Suivi dossiers personnels").Range("G" & DrLig).Value = UCase(TextBox4.Value)
    ActiveWorkbook.Worksheets("Suivi dossiers personnels").Range("H" & DrLig).Value = TextBox5.Value
    ActiveWorkbook.Worksheets("Suivi dossiers personnels").Range("I" & DrLig).Value = TextBox6.Value
    ActiveWorkbook.Worksheets("Suivi dossiers personnels").Range("J" & DrLig).Value = ComboBox1.Value
    ActiveWorkbook.Worksheets("Suivi dossiers personnels").Range("K" & DrLig).Value = ComboBox2.Value
    ActiveWorkbook.Worksheets("Suivi dossiers personnels").Protect
     
    ActiveWorkbook.Worksheets("Suivi dossiers personnels").ListObjects("Tableau1"). _
            Sort.SortFields.Clear
        ActiveWorkbook.Worksheets("Suivi dossiers personnels").ListObjects("Tableau1"). _
            Sort.SortFields.Add Key:=Range("Tableau1[Date dossier]"), SortOn:= _
            xlSortOnValues, Order:=xlAscending, DataOption:=xlSortTextAsNumbers
        ActiveWorkbook.Worksheets("Suivi dossiers personnels").ListObjects("Tableau1"). _
            Sort.SortFields.Add Key:=Range("Tableau1[Nom]"), SortOn:=xlSortOnValues, _
            Order:=xlAscending, DataOption:=xlSortNormal
        ActiveWorkbook.Worksheets("Suivi dossiers personnels").ListObjects("Tableau1"). _
            Sort.SortFields.Add Key:=Range("Tableau1[Prénom]"), SortOn:=xlSortOnValues _
            , Order:=xlAscending, DataOption:=xlSortNormal
        With ActiveWorkbook.Worksheets("Suivi dossiers personnels").ListObjects( _
            "Tableau1").Sort
            .Header = xlYes
            .MatchCase = False
            .Orientation = xlTopToBottom
            .SortMethod = xlPinYin
            .Apply
        End With
     
    If ComboBox1.Value = "Oui" Then
     
    If ActiveWorkbook.Worksheets("Sortie_prison").Range("F12").Value = "" Then
    ActiveWorkbook.Worksheets("Sortie_prison").Unprotect
    ActiveWorkbook.Worksheets("Sortie_prison").Range("B12").Value = TextBox1.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("C12").Value = TextBox2.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("D12").FormulaLocal = "=ANNEE([Date dossier])"
    ActiveWorkbook.Worksheets("Sortie_prison").Range("E12").FormulaLocal = "=MOIS([Date dossier])"
    ActiveWorkbook.Worksheets("Sortie_prison").Range("F12").FormulaLocal = "=JOUR([Date dossier])"
    ActiveWorkbook.Worksheets("Sortie_prison").Range("G12").Value = TextBox3.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("H12").Value = UCase(TextBox4.Value)
    ActiveWorkbook.Worksheets("Sortie_prison").Range("I12").Value = TextBox5.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("J12").Value = TextBox6.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("K12").Value = ComboBox1.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("L12").Value = ComboBox2.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("M12").Value = Type_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("N12").Value = Dublin_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("O12").Value = Nationalite_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("P12").Value = Legitimite_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("Q12").Value = Validite_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("R12").Value = Dateentree_temp
    Application.EnableEvents = False
    If Sortie_temp = Oui Then
    ActiveWorkbook.Worksheets("Sortie_prison").Range("S12").Value = Date23_temp
    Else
    ActiveWorkbook.Worksheets("Sortie_prison").Range("S12").FormulaLocal = "=SI([Date sortie]="""";"""";[Date entrée]+[Calcul_date])"
    End If
    Application.EnableEvents = True
    ActiveWorkbook.Worksheets("Sortie_prison").Range("U12").Value = Datesortie_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("W12").Value = Remarques_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("B12:L12").Font.Italic = True
    ActiveWorkbook.Worksheets("Sortie_prison").Range("T_Prison[Statut]").Locked = False
    ActiveWorkbook.Worksheets("Sortie_prison").Range("T_Prison[[Type dossier]:[Remarques]]").Locked = False
    ActiveWorkbook.Worksheets("Sortie_prison").Protect DrawingObjects:=False
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
    Unload Userform_patienter
    UserForm_operationsucces.Show
    Exit Sub
    Else
    DerLign = ActiveWorkbook.Worksheets("Sortie_prison").Range("A" & Rows.Count).End(xlUp).Row + 1
    ActiveWorkbook.Worksheets("Sortie_prison").Unprotect
    ActiveWorkbook.Worksheets("Sortie_prison").ListObjects("T_Prison").Resize Range("A11:W" & DerLign)
    ActiveWorkbook.Worksheets("Sortie_prison").Range("B" & DerLign).Value = TextBox1.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("C" & DerLign).Value = TextBox2.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("D" & DerLign).FormulaLocal = "=ANNEE([Date dossier])"
    ActiveWorkbook.Worksheets("Sortie_prison").Range("E" & DerLign).FormulaLocal = "=MOIS([Date dossier])"
    ActiveWorkbook.Worksheets("Sortie_prison").Range("F" & DerLign).FormulaLocal = "=JOUR([Date dossier])"
    ActiveWorkbook.Worksheets("Sortie_prison").Range("G" & DerLign).Value = TextBox3.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("H" & DerLign).Value = UCase(TextBox4.Value)
    ActiveWorkbook.Worksheets("Sortie_prison").Range("I" & DerLign).Value = TextBox5.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("J" & DerLign).Value = TextBox6.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("K" & DerLign).Value = ComboBox1.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("L" & DerLign).Value = ComboBox2.Value
    ActiveWorkbook.Worksheets("Sortie_prison").Range("M" & DerLign).Value = Type_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("N" & DerLign).Value = Dublin_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("O" & DerLign).Value = Nationalite_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("P" & DerLign).Value = Legitimite_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("Q" & DerLign).Value = Validite_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("R" & DerLign).Value = Dateentree_temp
    Application.EnableEvents = False
    If Sortie_temp = Oui Then
    ActiveWorkbook.Worksheets("Sortie_prison").Range("S" & DerLign).Value = Date23_temp
    Else
    ActiveWorkbook.Worksheets("Sortie_prison").Range("S" & DerLign).FormulaLocal = "=SI([Date sortie]="""";"""";[Date entrée]+[Calcul_date])"
    End If
    Application.EnableEvents = True
    ActiveWorkbook.Worksheets("Sortie_prison").Range("U" & DerLign).Value = Datesortie_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("W" & DerLign).Value = Remarques_temp
    ActiveWorkbook.Worksheets("Sortie_prison").Range("B13:L" & DerLign).Font.Italic = True
    ActiveWorkbook.Worksheets("Sortie_prison").Range("T_Prison[Statut]").Locked = False
    ActiveWorkbook.Worksheets("Sortie_prison").Range("T_Prison[[Type dossier]:[Remarques]]").Locked = False
     
      ActiveWorkbook.Worksheets("Sortie_prison").ListObjects("T_Prison").Sort. _
            SortFields.Clear
        ActiveWorkbook.Worksheets("Sortie_prison").ListObjects("T_Prison").Sort. _
            SortFields.Add Key:=Range("T_Prison[Date dossier]"), SortOn:=xlSortOnValues _
            , Order:=xlAscending, DataOption:=xlSortTextAsNumbers
        ActiveWorkbook.Worksheets("Sortie_prison").ListObjects("T_Prison").Sort. _
            SortFields.Add Key:=Range("T_Prison[Nom]"), SortOn:=xlSortOnValues, Order _
            :=xlAscending, DataOption:=xlSortNormal
        ActiveWorkbook.Worksheets("Sortie_prison").ListObjects("T_Prison").Sort. _
            SortFields.Add Key:=Range("T_Prison[Prénom]"), SortOn:=xlSortOnValues, _
            Order:=xlAscending, DataOption:=xlSortNormal
        With ActiveWorkbook.Worksheets("Sortie_prison").ListObjects("T_Prison").Sort
            .Header = xlYes
            .MatchCase = False
            .Orientation = xlTopToBottom
            .SortMethod = xlPinYin
            .Apply
        End With
    ActiveWorkbook.Worksheets("Sortie_prison").Protect DrawingObjects:=False
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
    Unload Userform_patienter
    UserForm_operationsucces.Show
    Exit Sub
    End If
    End If
     
    If ComboBox1.Value = "Non" Then
     
    If ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("F12").Value = "" Then
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Unprotect
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("B12").Value = TextBox1.Value
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("C12").Value = TextBox2.Value
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("D12").FormulaLocal = "=ANNEE([Date dossier])"
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("E12").FormulaLocal = "=MOIS([Date dossier])"
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("F12").FormulaLocal = "=JOUR([Date dossier])"
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("G12").Value = TextBox3.Value
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("H12").Value = UCase(TextBox4.Value)
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("I12").Value = TextBox5.Value
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("J12").Value = TextBox6.Value
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("K12").Value = ComboBox1.Value
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("L12").Value = Type_temp
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("M12").Value = Dublin_temp
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("N12").Value = Nationalite_temp
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("O12").Value = Legitimite_temp
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("P12").Value = Validite_temp
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("Q12").Value = Lieu_temp
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("R12").Value = Remarques_temp
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("B12:K12").Font.Italic = True
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range(Tableau_locked).Locked = False
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range(Tableau_locked2).Locked = False
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Protect DrawingObjects:=False
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
    Unload Userform_patienter
    UserForm_operationsucces.Show
    Exit Sub
    Else
    DerLign = ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("A" & Rows.Count).End(xlUp).Row + 1
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Unprotect
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).ListObjects(Tableau_temp).Resize Range("A11:R" & DerLign)
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("B" & DerLign).Value = TextBox1.Value
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("C" & DerLign).Value = TextBox2.Value
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("D" & DerLign).FormulaLocal = "=ANNEE([Date dossier])"
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("E" & DerLign).FormulaLocal = "=MOIS([Date dossier])"
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("F" & DerLign).FormulaLocal = "=JOUR([Date dossier])"
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("G" & DerLign).Value = TextBox3.Value
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("H" & DerLign).Value = UCase(TextBox4.Value)
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("I" & DerLign).Value = TextBox5.Value
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("J" & DerLign).Value = TextBox6.Value
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("K" & DerLign).Value = ComboBox1.Value
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("L" & DerLign).Value = Type_temp
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("M" & DerLign).Value = Dublin_temp
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("N" & DerLign).Value = Nationalite_temp
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("O" & DerLign).Value = Legitimite_temp
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("P" & DerLign).Value = Validite_temp
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("Q" & DerLign).Value = Lieu_temp
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("R" & DerLign).Value = Remarques_temp
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range("B13:K" & DerLign).Font.Italic = True
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range(Tableau_locked).Locked = False
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Range(Tableau_locked2).Locked = False
     
       ActiveWorkbook.Worksheets(Moisdossier_temp_After).ListObjects(Tableau_temp).Sort.SortFields.Clear
        ActiveWorkbook.Worksheets(Moisdossier_temp_After).ListObjects(Tableau_temp).Sort.SortFields.Add _
            Key:=Range(Tableau_champ1), SortOn:=xlSortOnValues, Order:= _
            xlAscending, DataOption:=xlSortTextAsNumbers
        ActiveWorkbook.Worksheets(Moisdossier_temp_After).ListObjects(Tableau_temp).Sort.SortFields.Add _
            Key:=Range(Tableau_champ2), SortOn:=xlSortOnValues, Order:=xlAscending, _
            DataOption:=xlSortNormal
        ActiveWorkbook.Worksheets(Moisdossier_temp_After).ListObjects(Tableau_temp).Sort.SortFields.Add _
            Key:=Range(Tableau_champ3), SortOn:=xlSortOnValues, Order:=xlAscending, _
            DataOption:=xlSortNormal
        With ActiveWorkbook.Worksheets(Moisdossier_temp_After).ListObjects(Tableau_temp).Sort
            .Header = xlYes
            .MatchCase = False
            .Orientation = xlTopToBottom
            .SortMethod = xlPinYin
            .Apply
        End With
    ActiveWorkbook.Worksheets(Moisdossier_temp_After).Protect DrawingObjects:=False
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
    Unload Userform_patienter
    UserForm_operationsucces.Show
    Exit Sub
    End If
    End If
     
    End Sub

+ Répondre à la discussion
Cette discussion est résolue.
Page 1 sur 2 12 DernièreDernière

Discussions similaires

  1. [XL-2007] Recherche plusieurs valeurs selon deux critères
    Par Flal 60 dans le forum Excel
    Réponses: 7
    Dernier message: 07/04/2014, 18h41
  2. Rechercher plusieurs valeurs
    Par chipster008 dans le forum Macros et VBA Excel
    Réponses: 10
    Dernier message: 07/04/2011, 22h47
  3. Réponses: 9
    Dernier message: 14/07/2010, 20h35
  4. rechercher plusieurs valeurs dans un tableau
    Par biche1 dans le forum Excel
    Réponses: 2
    Dernier message: 18/09/2008, 15h28
  5. formulaire de recherche, plusieurs valeurs
    Par joseph.breham dans le forum IHM
    Réponses: 5
    Dernier message: 18/09/2006, 16h02

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