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 :

Soucis avec une macro Excel


Sujet :

Macros et VBA Excel

  1. #21
    Expert éminent sénior
    Homme Profil pro
    aucune
    Inscrit en
    Septembre 2011
    Messages
    8 203
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : aucune

    Informations forums :
    Inscription : Septembre 2011
    Messages : 8 203
    Points : 14 354
    Points
    14 354
    Par défaut
    C'est vrai, mais c'est un fourre-tout. Tu as mis toutes les macros de ton classeur. Je te demande la "bonne" macro; je n'ai pas le temps de fouiller l'ensemble de ton code.
    Cordialement.

    Daniel

    La plus perdue de toutes les journées est celle où l'on n'a pas ri. Chamfort

  2. #22
    Membre à l'essai
    Homme Profil pro
    Debutant/Stagiaire
    Inscrit en
    Novembre 2014
    Messages
    29
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Debutant/Stagiaire

    Informations forums :
    Inscription : Novembre 2014
    Messages : 29
    Points : 15
    Points
    15
    Par défaut
    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
    'ferme et enregistre le nouveau classeur
    Sub EnregisterFermer(ClassFinal As String, NomClassIn As String)
       Dim NomXL As String
       Dim fs As New Scripting.FileSystemObject
       Dim recup_dossier  As Variant
       Dim recup_resulto  As String
     
       On Error Resume Next
     
     
       'NomXL = Environ("RESULTO") + "\" + ChangeFileExt(NomClassIn, "xlsx")
       NomXL = GetFilePath(Environ("RESULTO")) + "\" + ChangeFileExt(NomClassIn, "xlsx")
     
       ' ***** Modification du nom du classeur final 18/02/2013 ******* "
       recup_dossier = Split(NomXL, "_")
       recup_resulto = recup_dossier(0)
       NomXL = recup_resulto + "_Statistiques_Deduplication.xlsx"
       'MsgBox "Nomxl : " & NomXL
     
     
     
       fs.DeleteFile NomXL, True
       Workbooks(ClassFinal).Activate
       ActiveWorkbook.SaveAs FileName:=NomXL, CreateBackup:=False
     
       ActiveWorkbook.Close
    End Sub
    Je précise que EnregistrerFermer est appelé a un autre moment dans le code si il te faut aussi cette parti de code je te l'ajouterai

    Est-ce que ça aide ?

  3. #23
    Membre éclairé Avatar de Nico Chg
    Homme Profil pro
    Apprenti ingénieur Business Development
    Inscrit en
    Juillet 2014
    Messages
    352
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Apprenti ingénieur Business Development
    Secteur : Agroalimentaire - Agriculture

    Informations forums :
    Inscription : Juillet 2014
    Messages : 352
    Points : 758
    Points
    758
    Par défaut
    Bonjour,

    Est ce que tu peux mettre ton code entre balise # ([code ][ /code]) pour plus de lisibilité ?

    Sinon, la première chose qui me choque :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    Workbooks(ClassFinal).Activate
    ActiveWorkbook.SaveAs FileName:=NomXL, CreateBackup:=False
    Peut être remplacer par
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Workbooks(ClassFinal).SaveAs FileName:=NomXL, CreateBackup:=False
    En plus d'éviter les erreurs.

    Je pense qu'il faut l'autre partie du code, car c'est pas dans la macro que l'on va définir ClassFinal et NomClassIn.
    Citation Envoyé par Oscar Wilde
    Je déteste les discussions: elles vous font parfois changer d'avis.

  4. #24
    Membre à l'essai
    Homme Profil pro
    Debutant/Stagiaire
    Inscrit en
    Novembre 2014
    Messages
    29
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Debutant/Stagiaire

    Informations forums :
    Inscription : Novembre 2014
    Messages : 29
    Points : 15
    Points
    15
    Par défaut
    Salut a toi,

    Je précise que je n'ai pas codé ça ^^ c'est de la récup et je demande une aide parce que je comprend pas tout donc si tu penses qu'il y a des modifs a faire je te fais confiance, après le code est en pièce jointe libre a toi de le récupérer et de voir ce qui cloche parce que moi je serai pas d'une grande aide, parce que si je le met entre cote tu vas beaucoup scroller.

  5. #25
    Membre éclairé Avatar de Nico Chg
    Homme Profil pro
    Apprenti ingénieur Business Development
    Inscrit en
    Juillet 2014
    Messages
    352
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Apprenti ingénieur Business Development
    Secteur : Agroalimentaire - Agriculture

    Informations forums :
    Inscription : Juillet 2014
    Messages : 352
    Points : 758
    Points
    758
    Par défaut
    Re-bonjour,

    Je n'ouvre pas les pièces jointes, donc je ne verrais pas la suite de ton code !

    Et malgré le fait que tu es débutant, je suis sûr que tu peux remonter là ou sont définis ces deux fameuse variables. Il faut un peu se plonger dans le code, (un ctrl + f suffit à trouver ou ces variables sont mentionnés).

    Une fois que tu as trouvé ou elles sont déclarés, tu peux venir poster ledit code ici, qu'en penses tu ?
    Citation Envoyé par Oscar Wilde
    Je déteste les discussions: elles vous font parfois changer d'avis.

  6. #26
    Expert éminent sénior
    Homme Profil pro
    aucune
    Inscrit en
    Septembre 2011
    Messages
    8 203
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : aucune

    Informations forums :
    Inscription : Septembre 2011
    Messages : 8 203
    Points : 14 354
    Points
    14 354
    Par défaut
    Je précise que EnregistrerFermer est appelé a un autre moment dans le code si il te faut aussi cette parti de code je te l'ajouterai
    C'est ce qu'on te demande !
    Cordialement.

    Daniel

    La plus perdue de toutes les journées est celle où l'on n'a pas ri. Chamfort

  7. #27
    Membre à l'essai
    Homme Profil pro
    Debutant/Stagiaire
    Inscrit en
    Novembre 2014
    Messages
    29
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Debutant/Stagiaire

    Informations forums :
    Inscription : Novembre 2014
    Messages : 29
    Points : 15
    Points
    15
    Par défaut
    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
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710
    711
    712
    713
    714
    715
    716
    717
    718
    719
    720
    721
    722
    723
    724
    725
    726
    727
    728
    729
    730
    731
    732
    733
    734
    735
    736
    737
    738
    739
    740
    741
    742
    743
    744
    745
    746
    747
    748
    749
    750
    751
    752
    753
    754
    755
    756
    757
    758
    759
    760
    761
    762
    763
    764
    765
    766
    767
    768
    769
    770
    771
    772
    773
    774
    775
    776
    777
    778
    779
    780
    781
    782
    783
    784
    785
    786
    787
    788
    789
    790
    791
    792
    793
    794
    795
    796
    797
    798
    799
    800
    801
    802
    803
    804
    805
    806
    807
    808
    809
    810
    811
    812
    813
    814
    815
    816
    817
    818
    819
    820
    821
    822
    823
    824
    825
    826
    827
    828
    829
    830
    831
    832
    833
    834
    835
    836
    837
    838
    839
    840
    841
    842
    843
    844
    845
    846
    847
    848
    849
    850
    851
    852
    853
    854
    855
    856
    857
    858
    859
    860
    861
    862
    863
    864
    865
    866
    867
    868
    869
    870
    871
    872
    873
    874
    875
    876
    877
    878
    879
    880
    881
    882
    883
    884
    885
    886
    887
    888
    889
    890
    891
    892
    893
    894
    895
    896
    897
    898
    899
    900
    901
    902
    903
    904
    905
    906
    907
    908
    909
    910
    911
    912
    913
    914
    915
    916
    917
    918
    919
    920
    921
    922
    923
    924
    925
    926
    927
    928
    929
    930
    931
    932
    933
    934
    935
    936
    937
    938
    939
    940
    941
    942
    943
    944
    945
    946
    947
    948
    949
    950
    951
    952
    953
    954
    955
    956
    957
    958
    959
    960
    961
    962
    963
    964
    965
    966
    967
    968
    969
    970
    971
    972
    973
    974
    975
    976
    977
    978
    979
    980
    981
    982
    983
    984
    985
    986
    987
    988
    989
    990
    991
    992
    993
    994
    995
    996
    997
    998
    999
    1000
    1001
    1002
    1003
    1004
    1005
    1006
    1007
    1008
    1009
    1010
    1011
    1012
    1013
    1014
    1015
    1016
    1017
    1018
    1019
    1020
    1021
    1022
    1023
    1024
    1025
    1026
    1027
    1028
    1029
    1030
    1031
    1032
    1033
    1034
    1035
    1036
    1037
    1038
    1039
    1040
    1041
    1042
    1043
    1044
    1045
    1046
    1047
    1048
    1049
    1050
    1051
     
    Option Explicit
    Public Erreur As String
    'Public LigneTab(1 To 20) As Variant
    Public LigneTab(1 To 1000, 1 To 10000) As Variant ' table à deux dimensions
    Public XLMain As String
    Public NOMBRE As Integer
    Public NOMBRE_EXCEL As Integer
    Public NBR_CHAMPS As Integer
    Public NomOnglet As String
     
    Sub tmp_deb()
       RetrieveData
    End Sub
     
    Sub Auto_Open()
       'ne pas executer le code si NOEXEC est present dans le repertoire.
       If ExistFile(GetFilePath(Environ("RESULTO")) + "\NOEXEC") Then
          MsgBox "fichier d'arret NOEXEC trouve"
          End
       End If
     
       Application.ReferenceStyle = xlA1
       XLMain = ActiveWorkbook.Name
       RetrieveData
    End Sub
     
     Function ExistFile(strPath As String) As Boolean
       Dim fs As Object
       Dim blnFExiste As Boolean
     
       Set fs = CreateObject("Scripting.FileSystemObject")
       If Not (fs.FileExists(strPath)) Then
          blnFExiste = False
          Else
             blnFExiste = True
       End If
       ExistFile = blnFExiste
     End Function
     
    'ouvre le classeur des donnees en entree
    Sub OuvrirFichierXL(ByVal FicTrt As String, ByRef ClassTrt As String, Erreur As String)
       On Error GoTo ErrorHandler
     
       Workbooks.OpenText FileName:=FicTrt, DataType:=xlDelimited, Other:=True, OtherChar:=";"
     
     
       'Workbooks.OpenText FileName:= _
        '    "C:\Dev\Excel\charade_avt_envoi\RESULTAT_exapaq03_AV_ENVOI.csv", Origin:= _
        '    xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
          '  xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=True, _
         '   Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), _
          '  Array(2, 1), Array(3, 1), Array(4, 1))
     
       ClassTrt = ActiveWorkbook.Name
       Range("B2").Select
       'ActiveCell.NumberFormat = "d mmmm yyyy"
       'Date
    Exit Sub
     
    ErrorHandler:
       Select Case Err.Number
          Case 1004 'fichier introuvable
          Erreur = Err.Description
          MsgBox Err.Description
       End Select
     
       Resume Next
    End Sub
     
    'ferme et enregistre le nouveau classeur
    Sub EnregisterFermer(ClassFinal As String, NomClassIn As String)
       Dim NomXL As String
       Dim fs As New Scripting.FileSystemObject
       Dim recup_dossier  As Variant
       Dim recup_resulto  As String
     
       On Error Resume Next
     
     
       'NomXL = Environ("RESULTO") + "\" + ChangeFileExt(NomClassIn, "xlsx")
       NomXL = GetFilePath(Environ("RESULTO")) + "\" + ChangeFileExt(NomClassIn, "xlsx")
     
       ' ***** Modification du nom du classeur final 18/02/2013 ******* "
       recup_dossier = Split(NomXL, "_")
       recup_resulto = recup_dossier(0)
       NomXL = recup_resulto + "_Statistiques_Deduplication.xlsx"
       'MsgBox "Nomxl : " & NomXL
     
     
     
       fs.DeleteFile NomXL, True
       Workbooks(ClassFinal).Activate
       ActiveWorkbook.SaveAs FileName:=NomXL, CreateBackup:=False
     
       ActiveWorkbook.Close
    End Sub
     
    Sub Fermer()
       Range("F2").Select
    End Sub
     
    ' Retrieve a file's path
    ' Note: trailing backslashes are never included in the result
    Function GetFilePath(FileName As String) As String
        Dim i As Long
        For i = Len(FileName) To 1 Step -1
            Select Case Mid$(FileName, i, 1)
                Case ":"
                    ' colons are always included in the result
                    GetFilePath = Left$(FileName, i)
                    Exit For
                Case "\"
                    ' backslash aren't included in the result
                    GetFilePath = Left$(FileName, i - 1)
                    Exit For
            End Select
        Next
    End Function
     
    ' Retrieve a file's name
    Private Function ExtractFileName(ByVal vStrFullPath As String) As String
        Dim intPos As Integer
        intPos = InStrRev(vStrFullPath, "\")
        ExtractFileName = Mid$(vStrFullPath, intPos + 1)
    End Function
     
    Private Function ChangeFileExt(Fichier As String, Ext As String)
       Dim i As Integer
     
       i = InStrRev(Fichier, ".")
          If i > 0 Then
          ChangeFileExt = Mid(Fichier, 1, i - 1) + "." + Ext
          Else
          ChangeFileExt = Fichier
       End If
    End Function
    'copie des valeurs vers nouveau classeur
    Sub CopierValeurs(ByRef ClassFinal As String)
     
       Dim i As Double
       Dim l As Integer
       Dim lp As Integer
       Dim ls As Integer
     
       Dim h3 As Integer
       Dim c3 As Integer
       Dim t3 As Integer
     
       Dim tventlig As Integer
     
     
     
       Dim pourc_uniques As Double
       Dim pourc_repous  As Double
       Dim pourc_1grpe   As Double
       Dim pourc_ngrpe   As Double
       Dim pourc_aediter As Double
     
     
       Dim Q As Integer
       Dim colonne As Integer
     
       ClassFinal = Workbooks.Add.Name
       Workbooks(XLMain).Activate
     
     
     
       i = 1     'nb article lu
     
       l = 12    'ligne pour la feuille deduplication
       lp = 12   'ligne pour la feuille deduplication DOUBLON PURS
       ls = 12   'ligne pour la feuille deduplication DOUBLON supposes
     
       h3 = 8    'ligne pour la feuille de ventilation v3
       c3 = 0    'colonne pour la feuille de ventilation v3
       t3 = 0    'index pour la table ventilation v3
     
       tventlig = 3 'index pour le cumul ligne table ventilation v3
     
     
     
       Q = 0     'index pour le quadriage
     
       Workbooks(XLMain).Activate
       ActiveWorkbook.Sheets(1).Select
       Sheets(1).Copy before:=Workbooks(ClassFinal).Sheets(1)  'ok
     
       Workbooks(XLMain).Activate
       ActiveWorkbook.Sheets(2).Select
       Sheets(2).Copy before:=Workbooks(ClassFinal).Sheets(2)  'ok
     
       Workbooks(XLMain).Activate
       ActiveWorkbook.Sheets(3).Select
       Sheets(3).Copy before:=Workbooks(ClassFinal).Sheets(3)  'ok
     
       Workbooks(XLMain).Activate
       ActiveWorkbook.Sheets(4).Select
       Sheets(4).Copy before:=Workbooks(ClassFinal).Sheets(4)  'ok
     
       Workbooks(XLMain).Activate
       ActiveWorkbook.Sheets(5).Select
       Sheets(5).Copy before:=Workbooks(ClassFinal).Sheets(5)  'ok
     
       Do
     
     
           If UCase(LigneTab(i, 1)) = "ETAT00" Then
              ActiveWorkbook.Sheets(1).Select
     
             Range("F7").Value = LigneTab(i, 2) 'Nom du client
             Range("F8").Value = Date           'date traitement
     
     
           Else
     
             If UCase(LigneTab(i, 1)) = "ETAT01" Then  'deduplication
                 Range("A1").Select
     
                 ActiveWorkbook.Sheets(2).Select
                 Q = 1
                 l = l + 1
     
     
     
                 Cells(12, 3).Select
                 ActiveWindow.FreezePanes = True   'figer une cellule
     
     
                 If UCase(LigneTab(i, 2)) = "CUMUL" Then
                     l = l + 2
                 End If
     
                 Cells(l, 2).Font.FontStyle = "gras"
     
                 Cells(l, 3).NumberFormat = "#,##0"
                 Cells(l, 3).HorizontalAlignment = xlCenter
     
                 Cells(l, 4).NumberFormat = "#,##0"
                 Cells(l, 4).HorizontalAlignment = xlCenter
     
                 Cells(l, 5).NumberFormat = "#,##0"
                 Cells(l, 5).HorizontalAlignment = xlCenter
     
                 Cells(l, 6).NumberFormat = "0.00"
                 Cells(l, 6).HorizontalAlignment = xlCenter
     
                 Cells(l, 7).NumberFormat = "#,##0"
                 Cells(l, 7).HorizontalAlignment = xlCenter
     
                 Cells(l, 8).NumberFormat = "0.00"
                 Cells(l, 8).HorizontalAlignment = xlCenter
     
                 Cells(l, 9).NumberFormat = "#,##0"
                 Cells(l, 9).HorizontalAlignment = xlCenter
     
                 Cells(l, 10).NumberFormat = "0.00"
                 Cells(l, 10).HorizontalAlignment = xlCenter
     
                 Cells(l, 11).NumberFormat = "#,##0"
                 Cells(l, 11).HorizontalAlignment = xlCenter
     
                 Cells(l, 12).NumberFormat = "0.00"
                 Cells(l, 12).HorizontalAlignment = xlCenter
     
                 Cells(l, 13).NumberFormat = "#,##0"
                 Cells(l, 13).HorizontalAlignment = xlCenter
     
                 Cells(l, 14).NumberFormat = "0.00"
                 Cells(l, 14).HorizontalAlignment = xlCenter
     
     
                 If UCase(LigneTab(i, 2)) = "CUMUL" Or UCase(LigneTab(i, 2)) = "HORS REPOUSSOIR" Then
     
                    'Cells(l, 2).Font.FontStyle = "gras"
                    'Cells(l, 2).HorizontalAlignment = xlCenter
     
     
                    Cells(l, 3).Font.FontStyle = "gras"
                    Cells(l, 4).Font.FontStyle = "gras"
                    Cells(l, 5).Font.FontStyle = "gras"
                    Cells(l, 6).Font.FontStyle = "gras"
                    Cells(l, 7).Font.FontStyle = "gras"
                    Cells(l, 8).Font.FontStyle = "gras"
                    Cells(l, 9).Font.FontStyle = "gras"
                    Cells(l, 10).Font.FontStyle = "gras"
                    Cells(l, 11).Font.FontStyle = "gras"
                    Cells(l, 12).Font.FontStyle = "gras"
                    Cells(l, 13).Font.FontStyle = "gras"
                    Cells(l, 14).Font.FontStyle = "gras"
     
                 End If
     
     
     
     
                 Cells(l, 2).Value = LigneTab(i, 2)  'Nom du fichier
     
                 Cells(l, 3).Value = LigneTab(i, 3)  'nombre  adresses lues
                 Cells(l, 4).Value = LigneTab(i, 4)  'nombre  adresses rejetees
     
                 If LigneTab(i, 4) = "" And Cells(l, 2).Value <> "" Then
                    Cells(l, 4).Value = 0
                 End If
     
                 Cells(l, 5).Value = LigneTab(i, 5)  'nombre  adresses uniques
     
            '** calcul du pourcentage adresses uniques
                 If Cells(l, 2).Value <> "" Then
     
                  pourc_uniques = (LigneTab(i, 5) / LigneTab(i, 3)) * 100
                  Cells(l, 6).Value = pourc_uniques   'pourcentage adresses uniques
                 End If
     
     
                 Cells(l, 7).Value = LigneTab(i, 6)  'nombre adresses repoussees
     
              '** calcul du pourcentage adresses repoussees
                 If Cells(l, 2).Value <> "" Then
                   pourc_repous = (LigneTab(i, 6) / LigneTab(i, 3)) * 100
                   Cells(l, 8).Value = pourc_repous    'pourcentage adresses repoussees
                 End If
     
                 Cells(l, 9).Value = LigneTab(i, 7)  'nombre adresses 1er de groupe
     
                '** calcul du pourcentage adresses 1er de groupe
                 If Cells(l, 2).Value <> "" Then
                   pourc_1grpe = (LigneTab(i, 7) / LigneTab(i, 3)) * 100
                   Cells(l, 10).Value = pourc_1grpe   'pourcentage adresses 1er de groupe
                 End If
     
                 Cells(l, 11).Value = LigneTab(i, 8) 'nombre adresses nieme de groupe
     
                 '** calcul du pourcentage adresses nieme de groupe
                 If Cells(l, 11).Value <> "" Then
                   pourc_ngrpe = (LigneTab(i, 8) / LigneTab(i, 3)) * 100
                   Cells(l, 12).Value = pourc_ngrpe 'pourcentage adresses nieme de groupe
                 End If
     
                 Cells(l, 13).Value = LigneTab(i, 9) 'nombre adresses a editer
     
                 '** calcul du pourcentage adresses à editer
                 If Cells(l, 13).Value <> "" Then
                   pourc_aediter = (LigneTab(i, 9) / LigneTab(i, 3)) * 100
                   Cells(l, 14).Value = pourc_aediter 'pourcentage adresses a editer
                 End If
     
    'quadriage des cellules renseignées
                 Do
                 ' quadriage du tableau
     
                  If (UCase(LigneTab(i, 2)) = "CUMUL" Or UCase(LigneTab(i, 2)) = "HORS REPOUSSOIR") And (Q = 1) Then
     
                  Else
                     If Cells(l, Q).Value <> "" Then
     
                       Cells(l, Q).Select
                       Selection.Borders(xlDiagonalDown).LineStyle = xlNone
                       Selection.Borders(xlDiagonalUp).LineStyle = xlNone
                       With Selection.Borders(xlEdgeLeft)
                       .LineStyle = xlContinuous
                       .Weight = xlThin
                       .ColorIndex = xlAutomatic
                       End With
                       With Selection.Borders(xlEdgeTop)
                       .LineStyle = xlContinuous
                       .Weight = xlThin
                       .ColorIndex = xlAutomatic
                       End With
                       With Selection.Borders(xlEdgeBottom)
                       .LineStyle = xlContinuous
                       .Weight = xlThin
                       .ColorIndex = xlAutomatic
                       End With
                       With Selection.Borders(xlEdgeRight)
                       .LineStyle = xlContinuous
                       .Weight = xlThin
                       .ColorIndex = xlAutomatic
                       End With
                     End If
                    End If
                     Q = Q + 1
                 Loop Until Q > 14
     
     
     
               Else
     
                 If UCase(LigneTab(i, 1)) = "ETAT02" Then  'deduplication doublons purs
                 Range("A1").Select
     
                 ActiveWorkbook.Sheets(3).Select
                 Q = 1
                 lp = lp + 1
     
     
     
                 Cells(12, 3).Select
                 ActiveWindow.FreezePanes = True   'figer une cellule
     
     
                 If UCase(LigneTab(i, 2)) = "CUMUL" Then
                     lp = lp + 2
                 End If
     
                 Cells(lp, 2).Font.FontStyle = "gras"
     
     
                 Cells(lp, 3).NumberFormat = "#,##0"
                 Cells(lp, 3).HorizontalAlignment = xlCenter
     
                 Cells(lp, 4).NumberFormat = "#,##0"
                 Cells(lp, 4).HorizontalAlignment = xlCenter
     
                 Cells(lp, 5).NumberFormat = "#,##0"
                 Cells(lp, 5).HorizontalAlignment = xlCenter
     
                 Cells(lp, 6).NumberFormat = "0.00"
                 Cells(lp, 6).HorizontalAlignment = xlCenter
     
                 Cells(lp, 7).NumberFormat = "#,##0"
                 Cells(lp, 7).HorizontalAlignment = xlCenter
     
                 Cells(lp, 8).NumberFormat = "0.00"
                 Cells(lp, 8).HorizontalAlignment = xlCenter
     
                 Cells(lp, 9).NumberFormat = "#,##0"
                 Cells(lp, 9).HorizontalAlignment = xlCenter
     
                 Cells(lp, 10).NumberFormat = "0.00"
                 Cells(lp, 10).HorizontalAlignment = xlCenter
     
                 Cells(lp, 11).NumberFormat = "#,##0"
                 Cells(lp, 11).HorizontalAlignment = xlCenter
     
                 Cells(lp, 12).NumberFormat = "0.00"
                 Cells(lp, 12).HorizontalAlignment = xlCenter
     
                 Cells(lp, 13).NumberFormat = "#,##0"
                 Cells(lp, 13).HorizontalAlignment = xlCenter
     
                 Cells(lp, 14).NumberFormat = "0.00"
                 Cells(lp, 14).HorizontalAlignment = xlCenter
     
     
                 If UCase(LigneTab(i, 2)) = "CUMUL" Or UCase(LigneTab(i, 2)) = "HORS REPOUSSOIR" Then
     
                    'Cells(l, 2).Font.FontStyle = "gras"
                    'Cells(l, 2).HorizontalAlignment = xlCenter
     
     
                    Cells(lp, 3).Font.FontStyle = "gras"
                    Cells(lp, 4).Font.FontStyle = "gras"
                    Cells(lp, 5).Font.FontStyle = "gras"
                    Cells(lp, 6).Font.FontStyle = "gras"
                    Cells(lp, 7).Font.FontStyle = "gras"
                    Cells(lp, 8).Font.FontStyle = "gras"
                    Cells(lp, 9).Font.FontStyle = "gras"
                    Cells(lp, 10).Font.FontStyle = "gras"
                    Cells(lp, 11).Font.FontStyle = "gras"
                    Cells(lp, 12).Font.FontStyle = "gras"
                    Cells(lp, 13).Font.FontStyle = "gras"
                    Cells(lp, 14).Font.FontStyle = "gras"
     
                 End If
     
     
     
     
                 Cells(lp, 2).Value = LigneTab(i, 2)  'Nom du fichier
     
                 Cells(lp, 3).Value = LigneTab(i, 3)  'nombre  adresses lues
                 Cells(lp, 4).Value = LigneTab(i, 4)  'nombre  adresses rejetees
     
                 If LigneTab(i, 4) = "" And Cells(lp, 2).Value <> "" Then
                    Cells(lp, 4).Value = 0
                 End If
     
     
     
                 Cells(lp, 5).Value = LigneTab(i, 5)  'nombre  adresses uniques
     
            '** calcul du pourcentage adresses uniques
                 If Cells(lp, 2).Value <> "" Then
     
                  pourc_uniques = (LigneTab(i, 5) / LigneTab(i, 3)) * 100
                  Cells(lp, 6).Value = pourc_uniques   'pourcentage adresses uniques
                 End If
     
     
                 Cells(lp, 7).Value = LigneTab(i, 6)  'nombre adresses repoussees
     
              '** calcul du pourcentage adresses repoussees
                 If Cells(lp, 2).Value <> "" Then
                   pourc_repous = (LigneTab(i, 6) / LigneTab(i, 3)) * 100
                   Cells(lp, 8).Value = pourc_repous    'pourcentage adresses repoussees
                 End If
     
                 Cells(lp, 9).Value = LigneTab(i, 7)  'nombre adresses 1er de groupe
     
                '** calcul du pourcentage adresses 1er de groupe
                 If Cells(lp, 2).Value <> "" Then
                   pourc_1grpe = (LigneTab(i, 7) / LigneTab(i, 3)) * 100
                   Cells(lp, 10).Value = pourc_1grpe   'pourcentage adresses 1er de groupe
                 End If
     
                 Cells(lp, 11).Value = LigneTab(i, 8) 'nombre adresses nieme de groupe
     
                 '** calcul du pourcentage adresses nieme de groupe
                 If Cells(lp, 11).Value <> "" Then
                   pourc_ngrpe = (LigneTab(i, 8) / LigneTab(i, 3)) * 100
                   Cells(lp, 12).Value = pourc_ngrpe 'pourcentage adresses nieme de groupe
                 End If
     
                 Cells(lp, 13).Value = LigneTab(i, 9) 'nombre adresses a editer
     
                 '** calcul du pourcentage adresses à editer
                 If Cells(lp, 13).Value <> "" Then
                   pourc_aediter = (LigneTab(i, 9) / LigneTab(i, 3)) * 100
                   Cells(lp, 14).Value = pourc_aediter 'pourcentage adresses a editer
                 End If
     
    'quadriage des cellules renseignées
                 Do
                 ' quadriage du tableau
     
                  If (UCase(LigneTab(i, 2)) = "CUMUL" Or UCase(LigneTab(i, 2)) = "HORS REPOUSSOIR") And (Q = 1) Then
     
                  Else
                     If Cells(lp, Q).Value <> "" Then
     
                       Cells(lp, Q).Select
                       Selection.Borders(xlDiagonalDown).LineStyle = xlNone
                       Selection.Borders(xlDiagonalUp).LineStyle = xlNone
                       With Selection.Borders(xlEdgeLeft)
                       .LineStyle = xlContinuous
                       .Weight = xlThin
                       .ColorIndex = xlAutomatic
                       End With
                       With Selection.Borders(xlEdgeTop)
                       .LineStyle = xlContinuous
                       .Weight = xlThin
                       .ColorIndex = xlAutomatic
                       End With
                       With Selection.Borders(xlEdgeBottom)
                       .LineStyle = xlContinuous
                       .Weight = xlThin
                       .ColorIndex = xlAutomatic
                       End With
                       With Selection.Borders(xlEdgeRight)
                       .LineStyle = xlContinuous
                       .Weight = xlThin
                       .ColorIndex = xlAutomatic
                       End With
                     End If
                    End If
                     Q = Q + 1
                 Loop Until Q > 14
      '********************************************************
     
               Else
                 If UCase(LigneTab(i, 1)) = "ETAT03" Then  'deduplication doublons supposes
                 Range("A1").Select
     
                 ActiveWorkbook.Sheets(4).Select
                 Q = 1
                 ls = ls + 1
     
     
     
                 Cells(12, 3).Select
                 ActiveWindow.FreezePanes = True   'figer une cellule
     
     
                 If UCase(LigneTab(i, 2)) = "CUMUL" Then
                     ls = ls + 2
                 End If
     
                 Cells(ls, 2).Font.FontStyle = "gras"
     
                 Cells(ls, 3).NumberFormat = "#,##0"
                 Cells(ls, 3).HorizontalAlignment = xlCenter
     
                 Cells(ls, 4).NumberFormat = "#,##0"
                 Cells(ls, 4).HorizontalAlignment = xlCenter
     
                 Cells(ls, 5).NumberFormat = "#,##0"
                 Cells(ls, 5).HorizontalAlignment = xlCenter
     
                 Cells(ls, 6).NumberFormat = "0.00"
                 Cells(ls, 6).HorizontalAlignment = xlCenter
     
                 Cells(ls, 7).NumberFormat = "#,##0"
                 Cells(ls, 7).HorizontalAlignment = xlCenter
     
                 Cells(ls, 8).NumberFormat = "0.00"
                 Cells(ls, 8).HorizontalAlignment = xlCenter
     
                 Cells(ls, 9).NumberFormat = "#,##0"
                 Cells(ls, 9).HorizontalAlignment = xlCenter
     
                 Cells(ls, 10).NumberFormat = "0.00"
                 Cells(ls, 10).HorizontalAlignment = xlCenter
     
                 Cells(ls, 11).NumberFormat = "#,##0"
                 Cells(ls, 11).HorizontalAlignment = xlCenter
     
                 Cells(ls, 12).NumberFormat = "0.00"
                 Cells(ls, 12).HorizontalAlignment = xlCenter
     
                 Cells(ls, 13).NumberFormat = "#,##0"
                 Cells(ls, 13).HorizontalAlignment = xlCenter
     
                 Cells(ls, 14).NumberFormat = "0.00"
                 Cells(ls, 14).HorizontalAlignment = xlCenter
     
     
                 If UCase(LigneTab(i, 2)) = "CUMUL" Or UCase(LigneTab(i, 2)) = "HORS REPOUSSOIR" Then
     
                    'Cells(l, 2).Font.FontStyle = "gras"
                    'Cells(l, 2).HorizontalAlignment = xlCenter
     
     
                    Cells(ls, 3).Font.FontStyle = "gras"
                    Cells(ls, 4).Font.FontStyle = "gras"
                    Cells(ls, 5).Font.FontStyle = "gras"
                    Cells(ls, 6).Font.FontStyle = "gras"
                    Cells(ls, 7).Font.FontStyle = "gras"
                    Cells(ls, 8).Font.FontStyle = "gras"
                    Cells(ls, 9).Font.FontStyle = "gras"
                    Cells(ls, 10).Font.FontStyle = "gras"
                    Cells(ls, 11).Font.FontStyle = "gras"
                    Cells(ls, 12).Font.FontStyle = "gras"
                    Cells(ls, 13).Font.FontStyle = "gras"
                    Cells(ls, 14).Font.FontStyle = "gras"
     
                 End If
     
     
     
     
                 Cells(ls, 2).Value = LigneTab(i, 2)  'Nom du fichier
     
                 Cells(ls, 3).Value = LigneTab(i, 3)  'nombre  adresses lues
                 Cells(ls, 4).Value = LigneTab(i, 4)  'nombre  adresses rejetees
     
                 If LigneTab(i, 4) = "" And Cells(ls, 2).Value <> "" Then
                    Cells(ls, 4).Value = 0
                 End If
     
     
     
                 Cells(ls, 5).Value = LigneTab(i, 5)  'nombre  adresses uniques
     
            '** calcul du pourcentage adresses uniques
                 If Cells(ls, 2).Value <> "" Then
     
                  pourc_uniques = (LigneTab(i, 5) / LigneTab(i, 3)) * 100
                  Cells(ls, 6).Value = pourc_uniques   'pourcentage adresses uniques
                 End If
     
     
                 Cells(ls, 7).Value = LigneTab(i, 6)  'nombre adresses repoussees
     
              '** calcul du pourcentage adresses repoussees
                 If Cells(ls, 2).Value <> "" Then
                   pourc_repous = (LigneTab(i, 6) / LigneTab(i, 3)) * 100
                   Cells(ls, 8).Value = pourc_repous    'pourcentage adresses repoussees
                 End If
     
                 Cells(ls, 9).Value = LigneTab(i, 7)  'nombre adresses 1er de groupe
     
                '** calcul du pourcentage adresses 1er de groupe
                 If Cells(ls, 2).Value <> "" Then
                   pourc_1grpe = (LigneTab(i, 7) / LigneTab(i, 3)) * 100
                   Cells(ls, 10).Value = pourc_1grpe   'pourcentage adresses 1er de groupe
                 End If
     
                 Cells(ls, 11).Value = LigneTab(i, 8) 'nombre adresses nieme de groupe
     
                 '** calcul du pourcentage adresses nieme de groupe
                 If Cells(ls, 11).Value <> "" Then
                   pourc_ngrpe = (LigneTab(i, 8) / LigneTab(i, 3)) * 100
                   Cells(ls, 12).Value = pourc_ngrpe 'pourcentage adresses nieme de groupe
                 End If
     
                 Cells(ls, 13).Value = LigneTab(i, 9) 'nombre adresses a editer
     
                 '** calcul du pourcentage adresses à editer
                 If Cells(ls, 13).Value <> "" Then
                   pourc_aediter = (LigneTab(i, 9) / LigneTab(i, 3)) * 100
                   Cells(ls, 14).Value = pourc_aediter 'pourcentage adresses a editer
                 End If
     
    'quadriage des cellules renseignées
                 Do
                 ' quadriage du tableau
     
                  If (UCase(LigneTab(i, 2)) = "CUMUL" Or UCase(LigneTab(i, 2)) = "HORS REPOUSSOIR") And (Q = 1) Then
     
                  Else
                     If Cells(ls, Q).Value <> "" Then
     
                       Cells(ls, Q).Select
                       Selection.Borders(xlDiagonalDown).LineStyle = xlNone
                       Selection.Borders(xlDiagonalUp).LineStyle = xlNone
                       With Selection.Borders(xlEdgeLeft)
                       .LineStyle = xlContinuous
                       .Weight = xlThin
                       .ColorIndex = xlAutomatic
                       End With
                       With Selection.Borders(xlEdgeTop)
                       .LineStyle = xlContinuous
                       .Weight = xlThin
                       .ColorIndex = xlAutomatic
                       End With
                       With Selection.Borders(xlEdgeBottom)
                       .LineStyle = xlContinuous
                       .Weight = xlThin
                       .ColorIndex = xlAutomatic
                       End With
                       With Selection.Borders(xlEdgeRight)
                       .LineStyle = xlContinuous
                       .Weight = xlThin
                       .ColorIndex = xlAutomatic
                       End With
                     End If
                    End If
                     Q = Q + 1
                 Loop Until Q > 14
      '********************************************************
     
     
               Else
     
                  If UCase(LigneTab(i, 1)) = "ETAT04" Then  'ventilation des niemes
                   Range("A1").Select
                   colonne = LigneTab(i, 2)
     
                   ActiveWorkbook.Sheets(5).Select
     
     
     
                   h3 = h3 + 1
                   c3 = 2
                   t3 = 3
     
                   Cells(10, 3).Select
                   ActiveWindow.FreezePanes = True   'figer une cellule
     
     
                   Do
                    If c3 = LigneTab(i, 2) Or (LigneTab(i, 3) = "") Then
                       Cells(h3, c3).Font.FontStyle = "gras"
                    End If
     
     
                    Cells(h3, 2).Font.FontStyle = "gras"
     
     
                    Cells(h3, c3).NumberFormat = "#,##0"  'format cellule nombre av 0 decimale et separateur de milliers
                    Cells(h3, c3).HorizontalAlignment = xlCenter
                    Cells(h3, c3).Value = LigneTab(i, t3)
     
     
     
     
     
     ' quadriage des cellules renseignées
     
                     'If Cells(h3, c3).Value <> "" And Cells(h3, c3).Value <> " " Then 'quadriage des champs renseignes
                     If Cells(h3, c3).Value = "" And c3 = 2 Or Cells(h3, 2).Value = "" And h3 <> 9 Then
     
     
                     Else
                      If Cells(h3, c3).Value <> " " Then     ' quadriage du tableau
     
     
                       Cells(h3, c3).Select
                       Selection.Borders(xlDiagonalDown).LineStyle = xlNone
                       Selection.Borders(xlDiagonalUp).LineStyle = xlNone
                       With Selection.Borders(xlEdgeLeft)
                       .LineStyle = xlContinuous
                       .Weight = xlThin
                       .ColorIndex = xlAutomatic
                       End With
                       With Selection.Borders(xlEdgeTop)
                       .LineStyle = xlContinuous
                       .Weight = xlThin
                       .ColorIndex = xlAutomatic
                       End With
                       With Selection.Borders(xlEdgeBottom)
                       .LineStyle = xlContinuous
                       .Weight = xlThin
                       .ColorIndex = xlAutomatic
                       End With
                       With Selection.Borders(xlEdgeRight)
                       .LineStyle = xlContinuous
                       .Weight = xlThin
                       .ColorIndex = xlAutomatic
                       End With
                     End If
                    End If
     
     
     
     
                   t3 = t3 + 1
                   c3 = c3 + 1
                   Loop Until c3 > LigneTab(i, 2) - 1
     
               End If
               End If
     
               End If
     
              End If
     
           End If
     
     
     
     
     
         'les div par 100 sont mises pour compenser le formatage des cellules en %
         'Range("F14").Value = LigneTab(6) / 100 'ordre des lignes modifiees
     
     
     
         'Range("G26").Value = NBR_CHAMPS       'Nombre DE CHAMPS ecrits dans l enregistrement
         '''''Range("E30").Value = NOMBRE           'Nombre D ENREGISTREMENTS ecrits dans la table
         'Range("G28").Value = NOMBRE_EXCEL     'Nombre D ENREGISTREMENTS ecrits dans EXCEL
     
          'ActiveSheet.Name = NomOnglet
     
     
     
        'Suppression du quadriage
        ' ActiveWindow.DisplayGridlines = False
     
       i = i + 1
       Loop Until i > NOMBRE
     
     
     
      '**** Calcul Total Ligne Ventilation ****************************
     
       Dim rg As Range
     
       i = 10
     
     
       Do
          If Cells(i, 2).Value <> "" Then
            Set rg = ActiveSheet.Range(Cells(i, 3), Cells(i, colonne - 1))
            ActiveSheet.Cells(i, colonne).Formula = "=SUM(" & rg.AddressLocal & " )" 'total adresses ligne ventilation
     
     
            Cells(i, colonne).Font.FontStyle = "gras"
            Cells(i, colonne).NumberFormat = "#,##0" 'format cellule nombre av 0 decimale et separateur de milliers
            Cells(i, colonne).HorizontalAlignment = xlCenter
     
          End If
     
       'quadriage des cellules renseignées
     
             If Cells(i, colonne).Value <> "" Then
     
                       Cells(i, colonne).Select
                       Selection.Borders(xlDiagonalDown).LineStyle = xlNone
                       Selection.Borders(xlDiagonalUp).LineStyle = xlNone
                       With Selection.Borders(xlEdgeLeft)
                       .LineStyle = xlContinuous
                       .Weight = xlThin
                       .ColorIndex = xlAutomatic
                       End With
                       With Selection.Borders(xlEdgeTop)
                       .LineStyle = xlContinuous
                       .Weight = xlThin
                       .ColorIndex = xlAutomatic
                       End With
                       With Selection.Borders(xlEdgeBottom)
                       .LineStyle = xlContinuous
                       .Weight = xlThin
                       .ColorIndex = xlAutomatic
                       End With
                       With Selection.Borders(xlEdgeRight)
                       .LineStyle = xlContinuous
                       .Weight = xlThin
                       .ColorIndex = xlAutomatic
                       End With
     
             End If
     
     
       i = i + 1
       Loop Until i > h3
     
     
     
      '**** Calcul Total Colonne Ventilation  ************************
     
         tventlig = 3
         i = 3
     
         Do
            Set rg = ActiveSheet.Range(Cells(10, tventlig), Cells(h3, tventlig))
            ActiveSheet.Cells(h3 + 2, tventlig).Formula = "=SUM(" & rg.AddressLocal & " )" 'total adresses colonne ventilation
     
            Cells(h3 + 2, tventlig).Font.FontStyle = "gras"
            Cells(h3 + 2, tventlig).NumberFormat = "#,##0"  'format cellule nombre av 0 decimale et separateur de milliers
            Cells(h3 + 2, tventlig).HorizontalAlignment = xlCenter
     
     
       'quadriage des cellules renseignées
     
             If Cells(h3 + 2, i).Value <> "" Then
     
                       Cells(h3 + 2, i).Select
                       Selection.Borders(xlDiagonalDown).LineStyle = xlNone
                       Selection.Borders(xlDiagonalUp).LineStyle = xlNone
                       With Selection.Borders(xlEdgeLeft)
                       .LineStyle = xlContinuous
                       .Weight = xlThin
                       .ColorIndex = xlAutomatic
                       End With
                       With Selection.Borders(xlEdgeTop)
                       .LineStyle = xlContinuous
                       .Weight = xlThin
                       .ColorIndex = xlAutomatic
                       End With
                       With Selection.Borders(xlEdgeBottom)
                       .LineStyle = xlContinuous
                       .Weight = xlThin
                       .ColorIndex = xlAutomatic
                       End With
                       With Selection.Borders(xlEdgeRight)
                       .LineStyle = xlContinuous
                       .Weight = xlThin
                       .ColorIndex = xlAutomatic
                       End With
     
             End If
     
     
       tventlig = tventlig + 1
       i = i + 1
       Loop Until i > colonne - 1
     
     
       Range("A1").Select
     
    'Suppression des feuilles créees automatiquement
       Application.DisplayAlerts = False
     
     
       i = 1
       Do
         If UCase(Mid(ActiveWorkbook.Sheets(i).Name, 1, 5)) = "FEUIL" Then
                ActiveWorkbook.Sheets(i).Delete
         Else
           i = i + 1
         End If
         Loop Until i > ActiveWorkbook.Sheets.Count
     
    'fin suppression des feuilles créees automatiquement
     
      Worksheets(1).Select     'Ouvrir toujours sur la premiere feuille
     
     
    End Sub
    Sub RetrieveData()
       Dim Csv_in, Xls_out As String
       Dim Tmp_Classeur As Workbook
       Dim LgData As Range
       Dim TxtCsv_IN As String, ClassTrt As String, ClassClient As String
       Dim ClassFinal As String
       Dim i As Integer
     
       Dim j As Integer     ' indice pour la ligne
       Dim ITAB As Integer  ' indice pour la table
     
       Dim p As Variant
       Dim EcranMaj As Boolean
     
     
     
       XLMain = ActiveWorkbook.Name
       NomOnglet = ActiveSheet.Name
       TxtCsv_IN = Environ("RESULTO")
     
       ClassTrt = ExtractFileName(TxtCsv_IN)
     
     
       EcranMaj = Application.ScreenUpdating
     
       On Error GoTo ErrorHandler
       Application.ScreenUpdating = False
       OuvrirFichierXL TxtCsv_IN, ClassTrt, Erreur
     
       Workbooks(ClassTrt).Activate
     
       j = 2
       ITAB = 1
     
     
       Do
     
       'Range("A2").EntireRow.Select
        Range("A" & j).EntireRow.Select
     
     
     
          i = 1
          For Each p In Selection
             If i > 2000 Then
             'If IsEmpty(p.Value) Then   ' modif   '**** supprimer pour les fichiers crées par talend
             'If (p.value) is  null      ' bugge et permet d'afficher le fichier excel
               Exit For                          '**** separateurs consecutifs   ;; et non ; ; dans stat  ventilation
             End If
             LigneTab(ITAB, i) = p.Value
             i = i + 1
          Next
        j = j + 1
        ITAB = ITAB + 1
       Loop Until j > ActiveSheet.UsedRange.Rows.Count
     
     
       'Calcul du nombre dE CHAMPS ecrits dans un enregistrement
        NBR_CHAMPS = i - 1
     
       'Calcul du nombre d ENREGISTREMENTS ecrits dans la table
       NOMBRE = ActiveSheet.UsedRange.Rows.Count - 1
       NOMBRE_EXCEL = ActiveSheet.UsedRange.Rows.Count
     
       'fermeture TxtCsv_IN
       ActiveWorkbook.Close False
       CopierValeurs ClassFinal
     
     
       EnregisterFermer ClassFinal, ClassTrt 'Environ("STATEVAO")
       Application.ScreenUpdating = EcranMaj
       Application.Quit
    Exit Sub
     
    ErrorHandler:
       'MsgBox Erreur
       Application.ScreenUpdating = EcranMaj
       MsgBox Err.Description
       On Error GoTo 0
    End Sub

  8. #28
    Membre expert
    Avatar de Igloobel
    Homme Profil pro
    Développeur ERP - VBA et Formateur bureautique
    Inscrit en
    Septembre 2005
    Messages
    1 869
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Loiret (Centre)

    Informations professionnelles :
    Activité : Développeur ERP - VBA et Formateur bureautique
    Secteur : Industrie

    Informations forums :
    Inscription : Septembre 2005
    Messages : 1 869
    Points : 3 442
    Points
    3 442
    Billets dans le blog
    1
    Par défaut
    Bon,

    Ma question
    Est-ce que ces macros (car il y en a plusieurs) ont été créées sur une version antérieure à 2007 ? (il me semble que c'est le cas)
    c'est parce que je pensais qu'elles avaient été faite sur un Excel 2003 ou avant et que la migration de la version 2003 -> 2007 pose des problèmes de compatibilité (c'est du vécu )

    Tu dis aussi :
    ... mais mon excel 2013 est en anglais donc je galère un peu ...
    C'est pas un problème et de toute façon tes macros sont en anglais ...

    Alors si j'ai bien compris ça plante sur la ligne : Sub EnregisterFermer(ClassFinal As String, NomClassIn As String)
    dont voici le 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
    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
    'ferme et enregistre le nouveau classeur
    Sub EnregisterFermer(ClassFinal As String, NomClassIn As String)
       Dim NomXL As String
       Dim fs As New Scripting.FileSystemObject
       Dim recup_dossier  As Variant
       Dim recup_resulto  As String
     
       On Error Resume Next
     
     
       'NomXL = Environ("RESULTO") + "\" + ChangeFileExt(NomClassIn, "xlsx")
       NomXL = GetFilePath(Environ("RESULTO")) + "\" + ChangeFileExt(NomClassIn, "xlsx")
     
       ' ***** Modification du nom du classeur final 18/02/2013 ******* "
       recup_dossier = Split(NomXL, "_")
       recup_resulto = recup_dossier(0)
       NomXL = recup_resulto + "_Statistiques_Deduplication.xlsx"
       'MsgBox "Nomxl : " & NomXL
     
     
     
       fs.DeleteFile NomXL, True
       Workbooks(ClassFinal).Activate
       ActiveWorkbook.SaveAs FileName:=NomXL, CreateBackup:=False
     
       ActiveWorkbook.Close
    End Sub
     
    Sub Fermer()
       Range("F2").Select
    End Sub
     
    ' Retrieve a file's path
    ' Note: trailing backslashes are never included in the result
    Function GetFilePath(FileName As String) As String
        Dim i As Long
        For i = Len(FileName) To 1 Step -1
            Select Case Mid$(FileName, i, 1)
                Case ":"
                    ' colons are always included in the result
                    GetFilePath = Left$(FileName, i)
                    Exit For
                Case "\"
                    ' backslash aren't included in the result
                    GetFilePath = Left$(FileName, i - 1)
                    Exit For
            End Select
        Next
    End Function
    Daniel.C a dit
    Publie au moins le code de la macro qui appelle la procédure "EnregisterFermer".
    donc voici ce qu'il a demandé
    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
    Sub RetrieveData()
       Dim Csv_in, Xls_out As String
       Dim Tmp_Classeur As Workbook
       Dim LgData As Range
       Dim TxtCsv_IN As String, ClassTrt As String, ClassClient As String
       Dim ClassFinal As String
       Dim i As Integer
       
       Dim j As Integer     ' indice pour la ligne
       Dim ITAB As Integer  ' indice pour la table
       
       Dim p As Variant
       Dim EcranMaj As Boolean
          
       ...
       
       'fermeture TxtCsv_IN
       ActiveWorkbook.Close False
       CopierValeurs ClassFinal
          
       
       EnregisterFermer ClassFinal, ClassTrt 'Environ("STATEVAO")
       Application.ScreenUpdating = EcranMaj
       Application.Quit
    Exit Sub
    Donc je pense que ton passage de paramettre ne se fait pas bien ! Et je te laisse le soin de chercher.
    Si tu n'y arrive pas, fais un appelle de procédure simple (sans passage de paramètre) et tes paramètres déclare les en public

    A+
    Ils ne savaient pas que c'était impossible ... du coup ils l'ont fait (Mark Twain)

    n'oubliez pas de si les messages vous aide ou sont pertinents et de mettre quand cela est !

  9. #29
    Membre éclairé Avatar de Nico Chg
    Homme Profil pro
    Apprenti ingénieur Business Development
    Inscrit en
    Juillet 2014
    Messages
    352
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Apprenti ingénieur Business Development
    Secteur : Agroalimentaire - Agriculture

    Informations forums :
    Inscription : Juillet 2014
    Messages : 352
    Points : 758
    Points
    758
    Par défaut
    Re-bonjour,

    Je pense que Daniel.C a été clair, ton code est un fourre-tout (que ce soit le tient ou celui de quelqu'un d'autre, ce n'est pas une accusation), et c'est difficile de fouiller dedans. Nous n'avons pas tous le temps nécessaire pour remonter toutes tes macros.

    Il faut que tu trouve par toi même (tu peux faire des ctrl + f dans la fenêtre VBA) la ou sont déclaré, appelé (ou pas) tes fameuses variables.

    Bonne chance !
    Citation Envoyé par Oscar Wilde
    Je déteste les discussions: elles vous font parfois changer d'avis.

  10. #30
    Membre à l'essai
    Homme Profil pro
    Debutant/Stagiaire
    Inscrit en
    Novembre 2014
    Messages
    29
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Debutant/Stagiaire

    Informations forums :
    Inscription : Novembre 2014
    Messages : 29
    Points : 15
    Points
    15
    Par défaut
    Ok merci quand même je vais tenter de trouver.

  11. #31
    Membre expert
    Avatar de Igloobel
    Homme Profil pro
    Développeur ERP - VBA et Formateur bureautique
    Inscrit en
    Septembre 2005
    Messages
    1 869
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Loiret (Centre)

    Informations professionnelles :
    Activité : Développeur ERP - VBA et Formateur bureautique
    Secteur : Industrie

    Informations forums :
    Inscription : Septembre 2005
    Messages : 1 869
    Points : 3 442
    Points
    3 442
    Billets dans le blog
    1
    Par défaut
    Regarde mon post précedant je t'ai maché le travail


    A+
    Ils ne savaient pas que c'était impossible ... du coup ils l'ont fait (Mark Twain)

    n'oubliez pas de si les messages vous aide ou sont pertinents et de mettre quand cela est !

Discussions similaires

  1. gestion de stock avec une macro excel
    Par tchiph dans le forum Conception
    Réponses: 2
    Dernier message: 18/03/2011, 07h41
  2. Réponses: 0
    Dernier message: 27/01/2011, 18h07
  3. Souci avec une macro d'importation
    Par ZoeZeBest dans le forum VBA Access
    Réponses: 1
    Dernier message: 29/08/2008, 10h18
  4. Probleme de conversion entre . et , avec une macro excel
    Par fmris dans le forum Macros et VBA Excel
    Réponses: 2
    Dernier message: 18/01/2007, 22h26
  5. [vb6] Soucis avec une instance excel
    Par Little-Freud dans le forum VB 6 et antérieur
    Réponses: 6
    Dernier message: 24/04/2006, 16h08

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