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 :

Comment ouvrir un fichier excel avec une racine variable en vba [XL-2007]


Sujet :

Macros et VBA Excel

  1. #1
    Membre régulier
    Femme Profil pro
    comptable débutante
    Inscrit en
    Septembre 2015
    Messages
    10
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 35
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : comptable débutante

    Informations forums :
    Inscription : Septembre 2015
    Messages : 10
    Par défaut Comment ouvrir un fichier excel avec une racine variable en vba
    Bonjour,

    Je travaille sur une macro qui me permet de créer un TCD à partir d'un autre classeur excel qui me sert de base de données.
    Ce tcd est un outil qui va etre mis a disposition sur le serveur de mon entreprise.
    La macro marche mais le souci c'est la racine où est enregistrée mon classeur base de données. Elle est différente selon l'ordinateur utilisé.

    Actuellement mon code commence ainsi :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Workbooks.Open Filename:="Y:\FAStime\Technique\Base de données GDT.xlsb"
    or sur un autre pc l'acces au fichier pourrait etre "W:\FAStime\Technique\Base de données GDT.xlsb" par exemple.

    Quelle serait le code à ajouter au début de ma macro pour que le classeur " base de données GDT.xlsb" soit ouvert même si la racine est différente ?
    je vous remercie d'avance

    ps je suis novice

  2. #2
    Expert éminent


    Profil pro
    Inscrit en
    Juin 2003
    Messages
    14 008
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2003
    Messages : 14 008
    Par défaut
    Bonjour,

    et au final Y: et W: c'est des unités réseaux ?

  3. #3
    Membre chevronné Avatar de pasdechances
    Homme Profil pro
    Alternant, Ingénieur en systèmes Informatiques et Industriels
    Inscrit en
    Septembre 2015
    Messages
    218
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 32
    Localisation : France, Seine Saint Denis (Île de France)

    Informations professionnelles :
    Activité : Alternant, Ingénieur en systèmes Informatiques et Industriels
    Secteur : Industrie Pharmaceutique

    Informations forums :
    Inscription : Septembre 2015
    Messages : 218
    Par défaut
    Bonjour,
    pour répondre à ta demande il y a trois solutions :

    1) ouvrir une fenetre de requete pour choisir l'emplacement du fichier, se qui me permet de t'orienter vers ce fil
    2) inscrire tout les chemins possible dans ton classeur xD.(totalement inutile, mais possible)
    3) tu peut te servir de la fonction Dir() afin de scaner ton pc et de retrouver le fichier cherché.(extrement long si ton pc à beaucoup de fichier)

  4. #4
    Invité
    Invité(e)
    Par défaut
    bonjour,
    et avec son adresse IP: \\168.192.1.1\FAStime\Technique\Base de données GDT.xlsb?

  5. #5
    Membre régulier
    Femme Profil pro
    comptable débutante
    Inscrit en
    Septembre 2015
    Messages
    10
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 35
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : comptable débutante

    Informations forums :
    Inscription : Septembre 2015
    Messages : 10
    Par défaut
    Citation Envoyé par bbil Voir le message
    Bonjour,

    et au final Y: et W: c'est des unités réseaux ?

    oui c'est la lettre qui identifie l'unité réseau.

  6. #6
    Expert éminent


    Profil pro
    Inscrit en
    Juin 2003
    Messages
    14 008
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2003
    Messages : 14 008
    Par défaut
    utilise le nom UNC de ton répertoire :


    http://access.developpez.com/sources...=reseau#GetUNC

  7. #7
    Membre régulier
    Femme Profil pro
    comptable débutante
    Inscrit en
    Septembre 2015
    Messages
    10
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 35
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : comptable débutante

    Informations forums :
    Inscription : Septembre 2015
    Messages : 10
    Par défaut
    Citation Envoyé par rdurupt Voir le message
    bonjour,
    et avec son adresse IP: \\168.192.1.1\FAStime\Technique\Base de données GDT.xlsb?
    J'ai essayé avec mon adresse ip. C'est trop long et le chemin est introuvable

    Citation Envoyé par bbil Voir le message
    utilise le nom UNC de ton répertoire :


    http://access.developpez.com/sources...=reseau#GetUNC
    j'ai essayé en remplacant mon code par

    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
    Private Declare Function WNetGetConnection Lib "mpr.dll" Alias "WNetGetConnectionA" _
     (ByVal lpszLocalName As String, ByVal lpszRemoteName As String, cbRemoteName As Long) As Long
     
     
     
    Public Function fnctGetUNCPath(ByVal PathName As String) As String
    Const MAX_UNC_LENGTH  As Integer = 512
    Dim strUNCPath As String
    Dim strTempUNCName As String
    Dim lngReturnErrorCode  As Long
     
      strTempUNCName = String(MAX_UNC_LENGTH, 0)
      lngReturnErrorCode = WNetGetConnection(Left(PathName, 2), strTempUNCName, _
        MAX_UNC_LENGTH)
     
      If lngReturnErrorCode = 0 Then
         strTempUNCName = Trim(Left(strTempUNCName, InStr(strTempUNCName, vbNullChar) - 1))
         strUNCPath = strTempUNCName & Mid(PathName, 3)
      End If
     
    fnctGetUNCPath = strUNCPath
    End Function
    MsgBox fnctGetUNCPath("\FAStime\Technique\Base de données GDT.xlsb")
    j'ai un message d'erreur " seuls les commentaires peuvent apparaitre apres end sub, end fonction and property"
    en sachant qu'il y a le reste de ma macro qui suit

  8. #8
    Expert éminent


    Profil pro
    Inscrit en
    Juin 2003
    Messages
    14 008
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2003
    Messages : 14 008
    Par défaut
    Tu dois mettre ton appel à MsgBox dans une procédure (Sub ) et n'oublie pas la lettre du disque en paramètre.





    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    Sub MonNomUNC
      MsgBox fnctGetUNCPath("W:\FAStime\Technique\Base de données GDT.xlsb")
    End Sub

  9. #9
    Invité
    Invité(e)
    Par défaut
    quand tu vas dans l'explorateur Windows quel es l'adresse ip inscrit dans ton lecteur?
    ces celui là que tu dois écrire. mois j'ai des mapage a rallonge et ça fonctionne,je n'utilise jamais les le lettres du mapage!

  10. #10
    Expert éminent


    Profil pro
    Inscrit en
    Juin 2003
    Messages
    14 008
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2003
    Messages : 14 008
    Par défaut
    Citation Envoyé par rdurupt Voir le message
    quand tu vas dans l'explorateur Windows quel es l'adresse ip inscrit dans ton lecteur?
    ces celui là que tu dois écrire. mois j'ai des mapage a rallonge et ça fonctionne,je n'utilise jamais les le lettres du mapage!
    essai de voir ce qu'est le nom UNC d'un répertoire... l'adresse IP peu changer...

  11. #11
    Invité
    Invité(e)
    Par défaut
    oui effectivement le nom du serveur c'est mieux!

  12. #12
    Membre régulier
    Femme Profil pro
    comptable débutante
    Inscrit en
    Septembre 2015
    Messages
    10
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 35
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : comptable débutante

    Informations forums :
    Inscription : Septembre 2015
    Messages : 10
    Par défaut
    Ou trouve t on le nom du serveur?

  13. #13
    Invité
    Invité(e)
    Par défaut
    avec l'explorateur Windows raccourci clavier [drapeau Windows à coté de AltGr] + [E]

  14. #14
    Membre régulier
    Femme Profil pro
    comptable débutante
    Inscrit en
    Septembre 2015
    Messages
    10
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 35
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : comptable débutante

    Informations forums :
    Inscription : Septembre 2015
    Messages : 10
    Par défaut
    Bon j'arrive toujours pas! je vous montre mon code en entier pour la création de mon tcd . J'ai essayé la méthode qui me paraissait la plus simple avec le remplacement de " Y" par le nom de mon serveur. Le reste du code marche nickel. PS ca me marque toujours que le chemin d'acces est introuvable

    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
    Sub MacroFAStimeDIRECTOR()
    '
    ' MacroFAStimeDIRECTOR Macro
    ' MACRO TCD FAST TIME DIRECTOR
    '
     
    '
    Workbooks.Open Filename:="\\W7FRL237OL\FAStime\Technique\Base de données GDT.xlsb"
        Columns("A:N").Select
        Selection.Copy
        Windows("FAStime Reporting.xlsm").Activate
        Range("A1").Select
        ActiveSheet.Paste
        Columns("B:B").Select
        Application.CutCopyMode = False
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Range("B1").Select
        ActiveCell.FormulaR1C1 = "Contrat"
        Range("B2").Select
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-1],'[Base de données GDT.xlsb]Données-collaborateurs'!C1:C2,2,FALSE)"
        Range("B2").Select
        Selection.AutoFill Destination:=Range("B2:B32")
        Range("B2:B32").Select
        Columns("D:D").Select
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Range("D1").Select
        ActiveCell.FormulaR1C1 = "Date début période"
        Range("E1").Select
        ActiveCell.FormulaR1C1 = "Date fin période"
        Range("F1").Select
        ActiveCell.FormulaR1C1 = "Nb jr ouvrés"
        Range("G1").Select
        ActiveCell.FormulaR1C1 = "Statut période"
        Range("H1").Select
        ActiveCell.FormulaR1C1 = "Jr férié"
        Range("I1").Select
        ActiveCell.FormulaR1C1 = "Trimestre"
        Range("J1").Select
        ActiveCell.FormulaR1C1 = "Semestre"
        Range("K1").Select
        ActiveCell.FormulaR1C1 = "Critère 3 période"
        Range("D2").Select
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-1],'[Base de données GDT.xlsb]Données-périodes'!C1:C2,2,FALSE)"
        Columns("D:D").Select
        Selection.NumberFormat = "m/d/yyyy"
        Range("D2").Select
        Selection.AutoFill Destination:=Range("D2:D32")
        Range("D2:D32").Select
        Range("D2").Select
        Selection.Copy
        Range("E2").Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-2],'[Base de données GDT.xlsb]Données-périodes'!C1:C3,3,FALSE)"
        Range("E2").Select
        Selection.AutoFill Destination:=Range("E2:E32")
        Range("E2:E32").Select
        ActiveWindow.SmallScroll Down:=-3
        Range("E2").Select
        Selection.Copy
        Range("F2").Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-3],'[Base de données GDT.xlsb]Données-périodes'!C1:C4,4,FALSE)"
        Range("F2").Select
        Selection.NumberFormat = "General"
        Selection.AutoFill Destination:=Range("F2:F32")
        Range("F2:F32").Select
        Range("F2").Select
        Selection.Copy
        Range("G2").Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-4],'[Base de données GDT.xlsb]Données-périodes'!C1:C5,5,FALSE)"
        Range("G2").Select
        Selection.AutoFill Destination:=Range("G2:G32")
        Range("G2:G32").Select
        Range("G2").Select
        Selection.Copy
        Range("H2").Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-5],'[Base de données GDT.xlsb]Données-périodes'!C1:C6,6,FALSE)"
        Range("H2").Select
        Selection.AutoFill Destination:=Range("H2:H32")
        Range("H2:H32").Select
        Range("H2").Select
        Selection.Copy
        Range("I2").Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-6],'[Base de données GDT.xlsb]Données-périodes'!C1:C7,7,FALSE)"
        Range("I2").Select
        Selection.AutoFill Destination:=Range("I2:I32")
        Range("I2:I32").Select
        Range("I2").Select
        Selection.Copy
        Range("J2").Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-7],'[Base de données GDT.xlsb]Données-périodes'!C1:C8,8,FALSE)"
        Range("J2").Select
        Selection.AutoFill Destination:=Range("J2:J32")
        Range("J2:J32").Select
        Range("J2").Select
        Selection.Copy
        Range("K2").Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-8],'[Base de données GDT.xlsb]Données-périodes'!C1:C9,9,FALSE)"
        Range("K2").Select
        Selection.AutoFill Destination:=Range("K2:K32")
        Range("K2:K32").Select
        ActiveWindow.SmallScroll Down:=-3
        Columns("M:M").Select
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Range("M1").Select
        ActiveCell.FormulaR1C1 = "Description activité"
        Range("N1").Select
        ActiveCell.FormulaR1C1 = "Critère 1 activité"
        Range("O1").Select
        ActiveCell.FormulaR1C1 = "Critère 2 activité"
        Range("P1").Select
        ActiveCell.FormulaR1C1 = "Critère 3 activité"
        Range("M2").Select
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-1],'[Base de données GDT.xlsb]Données-activités'!C1:C2,2,FALSE)"
        Range("M2").Select
        Selection.AutoFill Destination:=Range("M2:M32")
        Range("M2:M32").Select
        Range("M2").Select
        Selection.Copy
        Range("N2").Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-2],'[Base de données GDT.xlsb]Données-activités'!C1:C3,3,FALSE)"
        Range("N2").Select
        Selection.AutoFill Destination:=Range("N2:N32")
        Range("N2:N32").Select
        Range("N2").Select
        Selection.Copy
        Range("O2").Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-3],'[Base de données GDT.xlsb]Données-activités'!C1:C4,4,FALSE)"
        Range("O3").Select
        ActiveWindow.SmallScroll Down:=-3
        Range("O2").Select
        Selection.AutoFill Destination:=Range("O2:O32")
        Range("O2:O32").Select
        Range("O2").Select
        Selection.Copy
        Range("P2").Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-4],'[Base de données GDT.xlsb]Données-activités'!C1:C5,5,FALSE)"
        Range("P2").Select
        Selection.AutoFill Destination:=Range("P2:P32")
        Range("P2:P32").Select
        ActiveWindow.ScrollColumn = 2
        ActiveWindow.ScrollColumn = 3
        ActiveWindow.ScrollColumn = 4
        ActiveWindow.ScrollColumn = 5
        ActiveWindow.ScrollColumn = 6
        ActiveWindow.ScrollColumn = 7
        ActiveWindow.ScrollColumn = 8
        ActiveWindow.ScrollColumn = 9
        Columns("R:R").Select
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Range("R1").Select
        ActiveCell.FormulaR1C1 = "Critère 1 projet"
        Range("S1").Select
        ActiveCell.FormulaR1C1 = "Critère 2 projet"
        Range("T1").Select
        ActiveCell.FormulaR1C1 = "Critère 3 projet"
        Range("R2").Select
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-1],'[Base de données GDT.xlsb]Données-projets'!C1:C2,2,FALSE)"
        Range("R2").Select
        Selection.AutoFill Destination:=Range("R2:R32")
        Range("R2:R32").Select
        Range("R2").Select
        Selection.Copy
        Range("S2").Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-2],'[Base de données GDT.xlsb]Données-projets'!C1:C3,3,FALSE)"
        Range("S2").Select
        Selection.AutoFill Destination:=Range("S2:S32")
        Range("S2:S32").Select
        Range("S2").Select
        Selection.Copy
        Range("T2").Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-3],'[Base de données GDT.xlsb]Données-projets'!C1:C4,4,FALSE)"
        Range("T3").Select
        ActiveWindow.SmallScroll ToRight:=3
        Range("T2").Select
        Selection.AutoFill Destination:=Range("T2:T32")
        Range("T2:T32").Select
        Columns("U:U").Select
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Range("U1").Select
        ActiveCell.FormulaR1C1 = "Définition domaine"
        Range("V1").Select
        ActiveCell.FormulaR1C1 = "Signification abréviation domaine"
        Range("W1").Select
        ActiveCell.FormulaR1C1 = "Critère 1 domaine"
        Range("X1").Select
        ActiveCell.FormulaR1C1 = "Critère 2 domaine"
        Range("Y1").Select
        ActiveCell.FormulaR1C1 = "Critère 3 domaine"
        Range("U2").Select
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-4],'[Base de données GDT.xlsb]Données-domaines'!C1:C2,2,FALSE)"
        Range("U2").Select
        Selection.AutoFill Destination:=Range("U2:U32")
        Range("U2:U32").Select
        Range("U1").Select
        ActiveCell.FormulaR1C1 = "Description domaine"
        Range("U2").Select
        Selection.Copy
        Range("V2").Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-5],'[Base de données GDT.xlsb]Données-domaines'!C1:C3,3,FALSE)"
        Range("V2").Select
        Selection.AutoFill Destination:=Range("V2:V32")
        Range("V2:V32").Select
        Range("V2").Select
        Selection.Copy
        Range("W2").Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-6],'[Base de données GDT.xlsb]Données-domaines'!C1:C4,4,FALSE)"
        Range("W2").Select
        Selection.AutoFill Destination:=Range("W2:W32")
        Range("W2:W32").Select
        Range("W2").Select
        Selection.Copy
        Range("X2").Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-7],'[Base de données GDT.xlsb]Données-domaines'!C1:C5,5,FALSE)"
        Range("X2").Select
        Selection.AutoFill Destination:=Range("X2:X32")
        Range("X2:X32").Select
        Range("X2").Select
        Selection.Copy
        Range("Y2").Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-8],'[Base de données GDT.xlsb]Données-domaines'!C1:C6,6,FALSE)"
        Range("Y2").Select
        Selection.AutoFill Destination:=Range("Y2:Y32")
        Range("Y2:Y32").Select
        ActiveWindow.SmallScroll Down:=0
        Columns("AA:AA").Select
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Range("AA1").Select
        ActiveCell.FormulaR1C1 = "Société Client"
        Range("AB1").Select
        ActiveCell.FormulaR1C1 = "critère 2 client"
        Range("AB1").Select
        ActiveCell.FormulaR1C1 = "Critère 2 client"
        Range("AC1").Select
        ActiveCell.FormulaR1C1 = "Critère 3 client"
        Range("AA2").Select
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-1],'[Base de données GDT.xlsb]Données-clients'!C1:C3,3,FALSE)"
        Range("AA2").Select
        Selection.AutoFill Destination:=Range("AA2:AA32")
        Range("AA2:AA32").Select
        Range("AA2").Select
        Selection.Copy
        Range("AB2").Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-2],'[Base de données GDT.xlsb]Données-clients'!C1:C4,4,FALSE)"
        Range("AB2").Select
        Selection.AutoFill Destination:=Range("AB2:AB32")
        Range("AB2:AB32").Select
        Range("AB2").Select
        Selection.Copy
        Range("AC2").Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-3],'[Base de données GDT.xlsb]Données-clients'!C1:C5,5,FALSE)"
        Range("AC2").Select
        Selection.AutoFill Destination:=Range("AC2:AC32")
        Range("AC2:AC32").Select
        ActiveWindow.SmallScroll ToRight:=2
        Columns("AD:AD").Select
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Range("AD1").Select
        ActiveCell.FormulaR1C1 = "Critère 1 partenaire"
        Range("AE1").Select
        ActiveCell.FormulaR1C1 = "Critère 2 partenaire"
        Range("AF1").Select
        ActiveCell.FormulaR1C1 = "Critère 3 partenaire"
        Range("AD2").Select
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-4],'[Base de données GDT.xlsb]Données-partenaires'!C1:C3,3,FALSE)"
        Range("AD2").Select
        Selection.AutoFill Destination:=Range("AD2:AD32")
        Range("AD2:AD32").Select
        Range("AD2").Select
        Selection.Copy
        Range("AE2").Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-5],'[Base de données GDT.xlsb]Données-partenaires'!C1:C4,4,FALSE)"
        Range("AE2").Select
        Selection.AutoFill Destination:=Range("AE2:AE32")
        Range("AE2:AE32").Select
        Range("AE2").Select
        Selection.Copy
        Range("AF2").Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-6],'[Base de données GDT.xlsb]Données-partenaires'!C1:C5,5,FALSE)"
        Range("AF2").Select
        Selection.AutoFill Destination:=Range("AF2:AF32")
        Range("AF2:AF32").Select
        ActiveWindow.SmallScroll ToRight:=4
        Columns("AJ:AJ").Select
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Range("AJ1").Select
        ActiveCell.FormulaR1C1 = "Critère 1 tâche"
        Range("AK1").Select
        ActiveCell.FormulaR1C1 = "Critère 2 tâche"
        Range("AL1").Select
        ActiveCell.FormulaR1C1 = "Critère 3 tâche"
        Range("AJ2").Select
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-1],'[Base de données GDT.xlsb]Données-taches'!C1:C2,2,FALSE)"
        Range("AJ2").Select
        Selection.AutoFill Destination:=Range("AJ2:AJ32")
        Range("AJ2:AJ32").Select
        Range("AJ2").Select
        Selection.Copy
        Range("AK2").Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-2],'[Base de données GDT.xlsb]Données-taches'!C1:C3,3,FALSE)"
        Range("AK2").Select
        Selection.AutoFill Destination:=Range("AK2:AK32")
        Range("AK2:AK32").Select
        Range("AK2").Select
        Selection.Copy
        Range("AL2").Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[-3],'[Base de données GDT.xlsb]Données-taches'!C1:C4,4,FALSE)"
        Range("AL2").Select
        Selection.AutoFill Destination:=Range("AL2:AL32")
        Range("AL2:AL32").Select
        ActiveWindow.SmallScroll Down:=-6
        Range("AC2").Select
        ActiveWindow.ScrollColumn = 28
        ActiveWindow.ScrollColumn = 27
        ActiveWindow.ScrollColumn = 26
        ActiveWindow.ScrollColumn = 25
        ActiveWindow.ScrollColumn = 24
        ActiveWindow.ScrollColumn = 23
        ActiveWindow.ScrollColumn = 22
        ActiveWindow.ScrollColumn = 21
        ActiveWindow.ScrollColumn = 20
        ActiveWindow.ScrollColumn = 19
        ActiveWindow.ScrollColumn = 18
        ActiveWindow.ScrollColumn = 17
        ActiveWindow.ScrollColumn = 16
        ActiveWindow.ScrollColumn = 15
        ActiveWindow.ScrollColumn = 14
        ActiveWindow.ScrollColumn = 13
        ActiveWindow.ScrollColumn = 12
        ActiveWindow.ScrollColumn = 11
        ActiveWindow.ScrollColumn = 10
        ActiveWindow.ScrollColumn = 9
        ActiveWindow.ScrollColumn = 8
        ActiveWindow.ScrollColumn = 7
        ActiveWindow.ScrollColumn = 6
        ActiveWindow.ScrollColumn = 5
        ActiveWindow.ScrollColumn = 4
        ActiveWindow.ScrollColumn = 3
        ActiveWindow.ScrollColumn = 2
        ActiveWindow.ScrollColumn = 1
        Range("A2").Select
     
        ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
            "Feuil1!R1C1:R1048576C44", Version:=xlPivotTableVersion12).CreatePivotTable _
            TableDestination:="", TableName:="Tableau croisé dynamique2", _
            DefaultVersion:=xlPivotTableVersion12
     
        With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields("Période" _
            )
            .Orientation = xlRowField
            .Position = 1
        End With
        With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields("Période" _
            )
            .Orientation = xlPageField
            .Position = 1
        End With
        With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields( _
            "Activité")
            .Orientation = xlRowField
            .Position = 1
        End With
        With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields( _
            "Domaine Fonctionnel ou Projet")
            .Orientation = xlRowField
            .Position = 2
        End With
        With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields( _
            "Domaine Fonctionnel ou Projet")
            .Orientation = xlColumnField
            .Position = 1
        End With
        With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields( _
            "Temps Total")
            .Orientation = xlRowField
            .Position = 2
        End With
        ActiveSheet.PivotTables("Tableau croisé dynamique2").AddDataField ActiveSheet. _
            PivotTables("Tableau croisé dynamique2").PivotFields("Temps Total"), _
            "Nombre de Temps Total", xlCount
    End Sub

  15. #15
    Expert éminent


    Profil pro
    Inscrit en
    Juin 2003
    Messages
    14 008
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2003
    Messages : 14 008
    Par défaut
    oups ....

    il fait peur ton code avec tous ces Activate Select... ActiveWindowsScroll...


    sinon pour le nom UNC il faut le nom du serveur + le nom du répertoire partagé sur ce serveur...

    as tu réussi à faire marcher la procédure :
    vu plus haut ..?.

  16. #16
    Invité
    Invité(e)
    Par défaut
    d’abot, ton classeur s'ouvre?

    quand tu place du code [code] [/code] j'ai pas touché ton code c'est juste pour te montrer la lisibilité!

    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
    Workbooks.Open Filename:="\\W7FRL237OL\FAStime\Technique\Base de données GDT.xlsb"
    Columns("A:N").Select
    Selection.Copy
    Windows("FAStime Reporting.xlsm").Activate
    Range("A1").Select
    ActiveSheet.Paste
    Columns("B:B").Select
    Application.CutCopyMode = False
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("B1").Select
    ActiveCell.FormulaR1C1 = "Contrat"
    Range("B2").Select
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-1],'[Base de données GDT.xlsb]Données-collaborateurs'!C1:C2,2,FALSE)"
    Range("B2").Select
    Selection.AutoFill Destination:=Range("B2:B32")
    Range("B2:B32").Select
    Columns("D").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("D1").Select
    ActiveCell.FormulaR1C1 = "Date début période"
    Range("E1").Select
    ActiveCell.FormulaR1C1 = "Date fin période"
    Range("F1").Select
    ActiveCell.FormulaR1C1 = "Nb jr ouvrés"
    Range("G1").Select
    ActiveCell.FormulaR1C1 = "Statut période"
    Range("H1").Select
    ActiveCell.FormulaR1C1 = "Jr férié"
    Range("I1").Select
    ActiveCell.FormulaR1C1 = "Trimestre"
    Range("J1").Select
    ActiveCell.FormulaR1C1 = "Semestre"
    Range("K1").Select
    ActiveCell.FormulaR1C1 = "Critère 3 période"
    Range("D2").Select
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-1],'[Base de données GDT.xlsb]Données-périodes'!C1:C2,2,FALSE)"
    Columns("D").Select
    Selection.NumberFormat = "m/d/yyyy"
    Range("D2").Select
    Selection.AutoFill Destination:=Range("D232")
    Range("D232").Select
    Range("D2").Select
    Selection.Copy
    Range("E2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-2],'[Base de données GDT.xlsb]Données-périodes'!C1:C3,3,FALSE)"
    Range("E2").Select
    Selection.AutoFill Destination:=Range("E2:E32")
    Range("E2:E32").Select
    ActiveWindow.SmallScroll Down:=-3
    Range("E2").Select
    Selection.Copy
    Range("F2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-3],'[Base de données GDT.xlsb]Données-périodes'!C1:C4,4,FALSE)"
    Range("F2").Select
    Selection.NumberFormat = "General"
    Selection.AutoFill Destination:=Range("F2:F32")
    Range("F2:F32").Select
    Range("F2").Select
    Selection.Copy
    Range("G2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-4],'[Base de données GDT.xlsb]Données-périodes'!C1:C5,5,FALSE)"
    Range("G2").Select
    Selection.AutoFill Destination:=Range("G2:G32")
    Range("G2:G32").Select
    Range("G2").Select
    Selection.Copy
    Range("H2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-5],'[Base de données GDT.xlsb]Données-périodes'!C1:C6,6,FALSE)"
    Range("H2").Select
    Selection.AutoFill Destination:=Range("H2:H32")
    Range("H2:H32").Select
    Range("H2").Select
    Selection.Copy
    Range("I2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-6],'[Base de données GDT.xlsb]Données-périodes'!C1:C7,7,FALSE)"
    Range("I2").Select
    Selection.AutoFill Destination:=Range("I2:I32")
    Range("I2:I32").Select
    Range("I2").Select
    Selection.Copy
    Range("J2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-7],'[Base de données GDT.xlsb]Données-périodes'!C1:C8,8,FALSE)"
    Range("J2").Select
    Selection.AutoFill Destination:=Range("J2:J32")
    Range("J2:J32").Select
    Range("J2").Select
    Selection.Copy
    Range("K2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-8],'[Base de données GDT.xlsb]Données-périodes'!C1:C9,9,FALSE)"
    Range("K2").Select
    Selection.AutoFill Destination:=Range("K2:K32")
    Range("K2:K32").Select
    ActiveWindow.SmallScroll Down:=-3
    Columns("M:M").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("M1").Select
    ActiveCell.FormulaR1C1 = "Description activité"
    Range("N1").Select
    ActiveCell.FormulaR1C1 = "Critère 1 activité"
    Range("O1").Select
    ActiveCell.FormulaR1C1 = "Critère 2 activité"
    Range("P1").Select
    ActiveCell.FormulaR1C1 = "Critère 3 activité"
    Range("M2").Select
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-1],'[Base de données GDT.xlsb]Données-activités'!C1:C2,2,FALSE)"
    Range("M2").Select
    Selection.AutoFill Destination:=Range("M2:M32")
    Range("M2:M32").Select
    Range("M2").Select
    Selection.Copy
    Range("N2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-2],'[Base de données GDT.xlsb]Données-activités'!C1:C3,3,FALSE)"
    Range("N2").Select
    Selection.AutoFill Destination:=Range("N2:N32")
    Range("N2:N32").Select
    Range("N2").Select
    Selection.Copy
    Range("O2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-3],'[Base de données GDT.xlsb]Données-activités'!C1:C4,4,FALSE)"
    Range("O3").Select
    ActiveWindow.SmallScroll Down:=-3
    Range("O2").Select
    Selection.AutoFill Destination:=Range("O2:O32")
    Range("O2:O32").Select
    Range("O2").Select
    Selection.Copy
    Range("P2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-4],'[Base de données GDT.xlsb]Données-activités'!C1:C5,5,FALSE)"
    Range("P2").Select
    Selection.AutoFill Destination:=Range("P232")
    Range("P232").Select
    ActiveWindow.ScrollColumn = 2
    ActiveWindow.ScrollColumn = 3
    ActiveWindow.ScrollColumn = 4
    ActiveWindow.ScrollColumn = 5
    ActiveWindow.ScrollColumn = 6
    ActiveWindow.ScrollColumn = 7
    ActiveWindow.ScrollColumn = 8
    ActiveWindow.ScrollColumn = 9
    Columns("R:R").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("R1").Select
    ActiveCell.FormulaR1C1 = "Critère 1 projet"
    Range("S1").Select
    ActiveCell.FormulaR1C1 = "Critère 2 projet"
    Range("T1").Select
    ActiveCell.FormulaR1C1 = "Critère 3 projet"
    Range("R2").Select
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-1],'[Base de données GDT.xlsb]Données-projets'!C1:C2,2,FALSE)"
    Range("R2").Select
    Selection.AutoFill Destination:=Range("R2:R32")
    Range("R2:R32").Select
    Range("R2").Select
    Selection.Copy
    Range("S2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-2],'[Base de données GDT.xlsb]Données-projets'!C1:C3,3,FALSE)"
    Range("S2").Select
    Selection.AutoFill Destination:=Range("S2:S32")
    Range("S2:S32").Select
    Range("S2").Select
    Selection.Copy
    Range("T2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-3],'[Base de données GDT.xlsb]Données-projets'!C1:C4,4,FALSE)"
    Range("T3").Select
    ActiveWindow.SmallScroll ToRight:=3
    Range("T2").Select
    Selection.AutoFill Destination:=Range("T2:T32")
    Range("T2:T32").Select
    Columns("U:U").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("U1").Select
    ActiveCell.FormulaR1C1 = "Définition domaine"
    Range("V1").Select
    ActiveCell.FormulaR1C1 = "Signification abréviation domaine"
    Range("W1").Select
    ActiveCell.FormulaR1C1 = "Critère 1 domaine"
    Range("X1").Select
    ActiveCell.FormulaR1C1 = "Critère 2 domaine"
    Range("Y1").Select
    ActiveCell.FormulaR1C1 = "Critère 3 domaine"
    Range("U2").Select
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-4],'[Base de données GDT.xlsb]Données-domaines'!C1:C2,2,FALSE)"
    Range("U2").Select
    Selection.AutoFill Destination:=Range("U2:U32")
    Range("U2:U32").Select
    Range("U1").Select
    ActiveCell.FormulaR1C1 = "Description domaine"
    Range("U2").Select
    Selection.Copy
    Range("V2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-5],'[Base de données GDT.xlsb]Données-domaines'!C1:C3,3,FALSE)"
    Range("V2").Select
    Selection.AutoFill Destination:=Range("V2:V32")
    Range("V2:V32").Select
    Range("V2").Select
    Selection.Copy
    Range("W2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-6],'[Base de données GDT.xlsb]Données-domaines'!C1:C4,4,FALSE)"
    Range("W2").Select
    Selection.AutoFill Destination:=Range("W2:W32")
    Range("W2:W32").Select
    Range("W2").Select
    Selection.Copy
    Range("X2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-7],'[Base de données GDT.xlsb]Données-domaines'!C1:C5,5,FALSE)"
    Range("X2").Select
    Selection.AutoFill Destination:=Range("X2:X32")
    Range("X2:X32").Select
    Range("X2").Select
    Selection.Copy
    Range("Y2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-8],'[Base de données GDT.xlsb]Données-domaines'!C1:C6,6,FALSE)"
    Range("Y2").Select
    Selection.AutoFill Destination:=Range("Y2:Y32")
    Range("Y2:Y32").Select
    ActiveWindow.SmallScroll Down:=0
    Columns("AA:AA").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("AA1").Select
    ActiveCell.FormulaR1C1 = "Société Client"
    Range("AB1").Select
    ActiveCell.FormulaR1C1 = "critère 2 client"
    Range("AB1").Select
    ActiveCell.FormulaR1C1 = "Critère 2 client"
    Range("AC1").Select
    ActiveCell.FormulaR1C1 = "Critère 3 client"
    Range("AA2").Select
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-1],'[Base de données GDT.xlsb]Données-clients'!C1:C3,3,FALSE)"
    Range("AA2").Select
    Selection.AutoFill Destination:=Range("AA2:AA32")
    Range("AA2:AA32").Select
    Range("AA2").Select
    Selection.Copy
    Range("AB2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-2],'[Base de données GDT.xlsb]Données-clients'!C1:C4,4,FALSE)"
    Range("AB2").Select
    Selection.AutoFill Destination:=Range("AB2:AB32")
    Range("AB2:AB32").Select
    Range("AB2").Select
    Selection.Copy
    Range("AC2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-3],'[Base de données GDT.xlsb]Données-clients'!C1:C5,5,FALSE)"
    Range("AC2").Select
    Selection.AutoFill Destination:=Range("AC2:AC32")
    Range("AC2:AC32").Select
    ActiveWindow.SmallScroll ToRight:=2
    Columns("AD:AD").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("AD1").Select
    ActiveCell.FormulaR1C1 = "Critère 1 partenaire"
    Range("AE1").Select
    ActiveCell.FormulaR1C1 = "Critère 2 partenaire"
    Range("AF1").Select
    ActiveCell.FormulaR1C1 = "Critère 3 partenaire"
    Range("AD2").Select
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-4],'[Base de données GDT.xlsb]Données-partenaires'!C1:C3,3,FALSE)"
    Range("AD2").Select
    Selection.AutoFill Destination:=Range("AD2:AD32")
    Range("AD2:AD32").Select
    Range("AD2").Select
    Selection.Copy
    Range("AE2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-5],'[Base de données GDT.xlsb]Données-partenaires'!C1:C4,4,FALSE)"
    Range("AE2").Select
    Selection.AutoFill Destination:=Range("AE2:AE32")
    Range("AE2:AE32").Select
    Range("AE2").Select
    Selection.Copy
    Range("AF2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-6],'[Base de données GDT.xlsb]Données-partenaires'!C1:C5,5,FALSE)"
    Range("AF2").Select
    Selection.AutoFill Destination:=Range("AF2:AF32")
    Range("AF2:AF32").Select
    ActiveWindow.SmallScroll ToRight:=4
    Columns("AJ:AJ").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("AJ1").Select
    ActiveCell.FormulaR1C1 = "Critère 1 tâche"
    Range("AK1").Select
    ActiveCell.FormulaR1C1 = "Critère 2 tâche"
    Range("AL1").Select
    ActiveCell.FormulaR1C1 = "Critère 3 tâche"
    Range("AJ2").Select
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-1],'[Base de données GDT.xlsb]Données-taches'!C1:C2,2,FALSE)"
    Range("AJ2").Select
    Selection.AutoFill Destination:=Range("AJ2:AJ32")
    Range("AJ2:AJ32").Select
    Range("AJ2").Select
    Selection.Copy
    Range("AK2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-2],'[Base de données GDT.xlsb]Données-taches'!C1:C3,3,FALSE)"
    Range("AK2").Select
    Selection.AutoFill Destination:=Range("AK2:AK32")
    Range("AK2:AK32").Select
    Range("AK2").Select
    Selection.Copy
    Range("AL2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-3],'[Base de données GDT.xlsb]Données-taches'!C1:C4,4,FALSE)"
    Range("AL2").Select
    Selection.AutoFill Destination:=Range("AL2:AL32")
    Range("AL2:AL32").Select
    ActiveWindow.SmallScroll Down:=-6
    Range("AC2").Select
    ActiveWindow.ScrollColumn = 28
    ActiveWindow.ScrollColumn = 27
    ActiveWindow.ScrollColumn = 26
    ActiveWindow.ScrollColumn = 25
    ActiveWindow.ScrollColumn = 24
    ActiveWindow.ScrollColumn = 23
    ActiveWindow.ScrollColumn = 22
    ActiveWindow.ScrollColumn = 21
    ActiveWindow.ScrollColumn = 20
    ActiveWindow.ScrollColumn = 19
    ActiveWindow.ScrollColumn = 18
    ActiveWindow.ScrollColumn = 17
    ActiveWindow.ScrollColumn = 16
    ActiveWindow.ScrollColumn = 15
    ActiveWindow.ScrollColumn = 14
    ActiveWindow.ScrollColumn = 13
    ActiveWindow.ScrollColumn = 12
    ActiveWindow.ScrollColumn = 11
    ActiveWindow.ScrollColumn = 10
    ActiveWindow.ScrollColumn = 9
    ActiveWindow.ScrollColumn = 8
    ActiveWindow.ScrollColumn = 7
    ActiveWindow.ScrollColumn = 6
    ActiveWindow.ScrollColumn = 5
    ActiveWindow.ScrollColumn = 4
    ActiveWindow.ScrollColumn = 3
    ActiveWindow.ScrollColumn = 2
    ActiveWindow.ScrollColumn = 1
    Range("A2").Select
     
    ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
    "Feuil1!R1C1:R1048576C44", Version:=xlPivotTableVersion12).CreatePivotTable _
    TableDestination:="", TableName:="Tableau croisé dynamique2", _
    DefaultVersion:=xlPivotTableVersion12
     
    With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields("Période" _
    )
    .Orientation = xlRowField
    .Position = 1
    End With
    With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields("Période" _
    )
    .Orientation = xlPageField
    .Position = 1
    End With
    With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields( _
    "Activité")
    .Orientation = xlRowField
    .Position = 1
    End With
    With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields( _
    "Domaine Fonctionnel ou Projet")
    .Orientation = xlRowField
    .Position = 2
    End With
    With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields( _
    "Domaine Fonctionnel ou Projet")
    .Orientation = xlColumnField
    .Position = 1
    End With
    With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields( _
    "Temps Total")
    .Orientation = xlRowField
    .Position = 2
    End With
    ActiveSheet.PivotTables("Tableau croisé dynamique2").AddDataField ActiveSheet. _
    PivotTables("Tableau croisé dynamique2").PivotFields("Temps Total"), _
    "Nombre de Temps Total", xlCount
    End Sub

  17. #17
    Membre régulier
    Femme Profil pro
    comptable débutante
    Inscrit en
    Septembre 2015
    Messages
    10
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 35
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : comptable débutante

    Informations forums :
    Inscription : Septembre 2015
    Messages : 10
    Par défaut
    Citation Envoyé par bbil Voir le message
    oups ....

    il fait peur ton code avec tous ces Activate Select... ActiveWindowsScroll...


    sinon pour le nom UNC il faut le nom du serveur + le nom du répertoire partagé sur ce serveur...

    as tu réussi à faire marcher la procédure :
    vu plus haut ..?.
    Désolé je suis une débutante de chez débutante ! bah j'ai le meme resultat que précedemment. Je me dis que j'ai du mal le placé dans mon code ( j'ai juste remplacer Workbooks.Open Filename:="Y:\FAStime\Technique\Base de données GDT.xlsb" ) désolé

  18. #18
    Membre régulier
    Femme Profil pro
    comptable débutante
    Inscrit en
    Septembre 2015
    Messages
    10
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 35
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : comptable débutante

    Informations forums :
    Inscription : Septembre 2015
    Messages : 10
    Par défaut
    Citation Envoyé par rdurupt Voir le message
    d’abot, ton classeur s'ouvre?

    quand tu place du code [code] [/code] j'ai pas touché ton code c'est juste pour te montrer la lisibilité!

    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
    Workbooks.Open Filename:="\\W7FRL237OL\FAStime\Technique\Base de données GDT.xlsb"
    Columns("A:N").Select
    Selection.Copy
    Windows("FAStime Reporting.xlsm").Activate
    Range("A1").Select
    ActiveSheet.Paste
    Columns("B:B").Select
    Application.CutCopyMode = False
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("B1").Select
    ActiveCell.FormulaR1C1 = "Contrat"
    Range("B2").Select
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-1],'[Base de données GDT.xlsb]Données-collaborateurs'!C1:C2,2,FALSE)"
    Range("B2").Select
    Selection.AutoFill Destination:=Range("B2:B32")
    Range("B2:B32").Select
    Columns("D").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("D1").Select
    ActiveCell.FormulaR1C1 = "Date début période"
    Range("E1").Select
    ActiveCell.FormulaR1C1 = "Date fin période"
    Range("F1").Select
    ActiveCell.FormulaR1C1 = "Nb jr ouvrés"
    Range("G1").Select
    ActiveCell.FormulaR1C1 = "Statut période"
    Range("H1").Select
    ActiveCell.FormulaR1C1 = "Jr férié"
    Range("I1").Select
    ActiveCell.FormulaR1C1 = "Trimestre"
    Range("J1").Select
    ActiveCell.FormulaR1C1 = "Semestre"
    Range("K1").Select
    ActiveCell.FormulaR1C1 = "Critère 3 période"
    Range("D2").Select
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-1],'[Base de données GDT.xlsb]Données-périodes'!C1:C2,2,FALSE)"
    Columns("D").Select
    Selection.NumberFormat = "m/d/yyyy"
    Range("D2").Select
    Selection.AutoFill Destination:=Range("D232")
    Range("D232").Select
    Range("D2").Select
    Selection.Copy
    Range("E2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-2],'[Base de données GDT.xlsb]Données-périodes'!C1:C3,3,FALSE)"
    Range("E2").Select
    Selection.AutoFill Destination:=Range("E2:E32")
    Range("E2:E32").Select
    ActiveWindow.SmallScroll Down:=-3
    Range("E2").Select
    Selection.Copy
    Range("F2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-3],'[Base de données GDT.xlsb]Données-périodes'!C1:C4,4,FALSE)"
    Range("F2").Select
    Selection.NumberFormat = "General"
    Selection.AutoFill Destination:=Range("F2:F32")
    Range("F2:F32").Select
    Range("F2").Select
    Selection.Copy
    Range("G2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-4],'[Base de données GDT.xlsb]Données-périodes'!C1:C5,5,FALSE)"
    Range("G2").Select
    Selection.AutoFill Destination:=Range("G2:G32")
    Range("G2:G32").Select
    Range("G2").Select
    Selection.Copy
    Range("H2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-5],'[Base de données GDT.xlsb]Données-périodes'!C1:C6,6,FALSE)"
    Range("H2").Select
    Selection.AutoFill Destination:=Range("H2:H32")
    Range("H2:H32").Select
    Range("H2").Select
    Selection.Copy
    Range("I2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-6],'[Base de données GDT.xlsb]Données-périodes'!C1:C7,7,FALSE)"
    Range("I2").Select
    Selection.AutoFill Destination:=Range("I2:I32")
    Range("I2:I32").Select
    Range("I2").Select
    Selection.Copy
    Range("J2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-7],'[Base de données GDT.xlsb]Données-périodes'!C1:C8,8,FALSE)"
    Range("J2").Select
    Selection.AutoFill Destination:=Range("J2:J32")
    Range("J2:J32").Select
    Range("J2").Select
    Selection.Copy
    Range("K2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-8],'[Base de données GDT.xlsb]Données-périodes'!C1:C9,9,FALSE)"
    Range("K2").Select
    Selection.AutoFill Destination:=Range("K2:K32")
    Range("K2:K32").Select
    ActiveWindow.SmallScroll Down:=-3
    Columns("M:M").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("M1").Select
    ActiveCell.FormulaR1C1 = "Description activité"
    Range("N1").Select
    ActiveCell.FormulaR1C1 = "Critère 1 activité"
    Range("O1").Select
    ActiveCell.FormulaR1C1 = "Critère 2 activité"
    Range("P1").Select
    ActiveCell.FormulaR1C1 = "Critère 3 activité"
    Range("M2").Select
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-1],'[Base de données GDT.xlsb]Données-activités'!C1:C2,2,FALSE)"
    Range("M2").Select
    Selection.AutoFill Destination:=Range("M2:M32")
    Range("M2:M32").Select
    Range("M2").Select
    Selection.Copy
    Range("N2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-2],'[Base de données GDT.xlsb]Données-activités'!C1:C3,3,FALSE)"
    Range("N2").Select
    Selection.AutoFill Destination:=Range("N2:N32")
    Range("N2:N32").Select
    Range("N2").Select
    Selection.Copy
    Range("O2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-3],'[Base de données GDT.xlsb]Données-activités'!C1:C4,4,FALSE)"
    Range("O3").Select
    ActiveWindow.SmallScroll Down:=-3
    Range("O2").Select
    Selection.AutoFill Destination:=Range("O2:O32")
    Range("O2:O32").Select
    Range("O2").Select
    Selection.Copy
    Range("P2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-4],'[Base de données GDT.xlsb]Données-activités'!C1:C5,5,FALSE)"
    Range("P2").Select
    Selection.AutoFill Destination:=Range("P232")
    Range("P232").Select
    ActiveWindow.ScrollColumn = 2
    ActiveWindow.ScrollColumn = 3
    ActiveWindow.ScrollColumn = 4
    ActiveWindow.ScrollColumn = 5
    ActiveWindow.ScrollColumn = 6
    ActiveWindow.ScrollColumn = 7
    ActiveWindow.ScrollColumn = 8
    ActiveWindow.ScrollColumn = 9
    Columns("R:R").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("R1").Select
    ActiveCell.FormulaR1C1 = "Critère 1 projet"
    Range("S1").Select
    ActiveCell.FormulaR1C1 = "Critère 2 projet"
    Range("T1").Select
    ActiveCell.FormulaR1C1 = "Critère 3 projet"
    Range("R2").Select
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-1],'[Base de données GDT.xlsb]Données-projets'!C1:C2,2,FALSE)"
    Range("R2").Select
    Selection.AutoFill Destination:=Range("R2:R32")
    Range("R2:R32").Select
    Range("R2").Select
    Selection.Copy
    Range("S2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-2],'[Base de données GDT.xlsb]Données-projets'!C1:C3,3,FALSE)"
    Range("S2").Select
    Selection.AutoFill Destination:=Range("S2:S32")
    Range("S2:S32").Select
    Range("S2").Select
    Selection.Copy
    Range("T2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-3],'[Base de données GDT.xlsb]Données-projets'!C1:C4,4,FALSE)"
    Range("T3").Select
    ActiveWindow.SmallScroll ToRight:=3
    Range("T2").Select
    Selection.AutoFill Destination:=Range("T2:T32")
    Range("T2:T32").Select
    Columns("U:U").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("U1").Select
    ActiveCell.FormulaR1C1 = "Définition domaine"
    Range("V1").Select
    ActiveCell.FormulaR1C1 = "Signification abréviation domaine"
    Range("W1").Select
    ActiveCell.FormulaR1C1 = "Critère 1 domaine"
    Range("X1").Select
    ActiveCell.FormulaR1C1 = "Critère 2 domaine"
    Range("Y1").Select
    ActiveCell.FormulaR1C1 = "Critère 3 domaine"
    Range("U2").Select
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-4],'[Base de données GDT.xlsb]Données-domaines'!C1:C2,2,FALSE)"
    Range("U2").Select
    Selection.AutoFill Destination:=Range("U2:U32")
    Range("U2:U32").Select
    Range("U1").Select
    ActiveCell.FormulaR1C1 = "Description domaine"
    Range("U2").Select
    Selection.Copy
    Range("V2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-5],'[Base de données GDT.xlsb]Données-domaines'!C1:C3,3,FALSE)"
    Range("V2").Select
    Selection.AutoFill Destination:=Range("V2:V32")
    Range("V2:V32").Select
    Range("V2").Select
    Selection.Copy
    Range("W2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-6],'[Base de données GDT.xlsb]Données-domaines'!C1:C4,4,FALSE)"
    Range("W2").Select
    Selection.AutoFill Destination:=Range("W2:W32")
    Range("W2:W32").Select
    Range("W2").Select
    Selection.Copy
    Range("X2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-7],'[Base de données GDT.xlsb]Données-domaines'!C1:C5,5,FALSE)"
    Range("X2").Select
    Selection.AutoFill Destination:=Range("X2:X32")
    Range("X2:X32").Select
    Range("X2").Select
    Selection.Copy
    Range("Y2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-8],'[Base de données GDT.xlsb]Données-domaines'!C1:C6,6,FALSE)"
    Range("Y2").Select
    Selection.AutoFill Destination:=Range("Y2:Y32")
    Range("Y2:Y32").Select
    ActiveWindow.SmallScroll Down:=0
    Columns("AA:AA").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("AA1").Select
    ActiveCell.FormulaR1C1 = "Société Client"
    Range("AB1").Select
    ActiveCell.FormulaR1C1 = "critère 2 client"
    Range("AB1").Select
    ActiveCell.FormulaR1C1 = "Critère 2 client"
    Range("AC1").Select
    ActiveCell.FormulaR1C1 = "Critère 3 client"
    Range("AA2").Select
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-1],'[Base de données GDT.xlsb]Données-clients'!C1:C3,3,FALSE)"
    Range("AA2").Select
    Selection.AutoFill Destination:=Range("AA2:AA32")
    Range("AA2:AA32").Select
    Range("AA2").Select
    Selection.Copy
    Range("AB2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-2],'[Base de données GDT.xlsb]Données-clients'!C1:C4,4,FALSE)"
    Range("AB2").Select
    Selection.AutoFill Destination:=Range("AB2:AB32")
    Range("AB2:AB32").Select
    Range("AB2").Select
    Selection.Copy
    Range("AC2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-3],'[Base de données GDT.xlsb]Données-clients'!C1:C5,5,FALSE)"
    Range("AC2").Select
    Selection.AutoFill Destination:=Range("AC2:AC32")
    Range("AC2:AC32").Select
    ActiveWindow.SmallScroll ToRight:=2
    Columns("AD:AD").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("AD1").Select
    ActiveCell.FormulaR1C1 = "Critère 1 partenaire"
    Range("AE1").Select
    ActiveCell.FormulaR1C1 = "Critère 2 partenaire"
    Range("AF1").Select
    ActiveCell.FormulaR1C1 = "Critère 3 partenaire"
    Range("AD2").Select
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-4],'[Base de données GDT.xlsb]Données-partenaires'!C1:C3,3,FALSE)"
    Range("AD2").Select
    Selection.AutoFill Destination:=Range("AD2:AD32")
    Range("AD2:AD32").Select
    Range("AD2").Select
    Selection.Copy
    Range("AE2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-5],'[Base de données GDT.xlsb]Données-partenaires'!C1:C4,4,FALSE)"
    Range("AE2").Select
    Selection.AutoFill Destination:=Range("AE2:AE32")
    Range("AE2:AE32").Select
    Range("AE2").Select
    Selection.Copy
    Range("AF2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-6],'[Base de données GDT.xlsb]Données-partenaires'!C1:C5,5,FALSE)"
    Range("AF2").Select
    Selection.AutoFill Destination:=Range("AF2:AF32")
    Range("AF2:AF32").Select
    ActiveWindow.SmallScroll ToRight:=4
    Columns("AJ:AJ").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("AJ1").Select
    ActiveCell.FormulaR1C1 = "Critère 1 tâche"
    Range("AK1").Select
    ActiveCell.FormulaR1C1 = "Critère 2 tâche"
    Range("AL1").Select
    ActiveCell.FormulaR1C1 = "Critère 3 tâche"
    Range("AJ2").Select
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-1],'[Base de données GDT.xlsb]Données-taches'!C1:C2,2,FALSE)"
    Range("AJ2").Select
    Selection.AutoFill Destination:=Range("AJ2:AJ32")
    Range("AJ2:AJ32").Select
    Range("AJ2").Select
    Selection.Copy
    Range("AK2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-2],'[Base de données GDT.xlsb]Données-taches'!C1:C3,3,FALSE)"
    Range("AK2").Select
    Selection.AutoFill Destination:=Range("AK2:AK32")
    Range("AK2:AK32").Select
    Range("AK2").Select
    Selection.Copy
    Range("AL2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(RC[-3],'[Base de données GDT.xlsb]Données-taches'!C1:C4,4,FALSE)"
    Range("AL2").Select
    Selection.AutoFill Destination:=Range("AL2:AL32")
    Range("AL2:AL32").Select
    ActiveWindow.SmallScroll Down:=-6
    Range("AC2").Select
    ActiveWindow.ScrollColumn = 28
    ActiveWindow.ScrollColumn = 27
    ActiveWindow.ScrollColumn = 26
    ActiveWindow.ScrollColumn = 25
    ActiveWindow.ScrollColumn = 24
    ActiveWindow.ScrollColumn = 23
    ActiveWindow.ScrollColumn = 22
    ActiveWindow.ScrollColumn = 21
    ActiveWindow.ScrollColumn = 20
    ActiveWindow.ScrollColumn = 19
    ActiveWindow.ScrollColumn = 18
    ActiveWindow.ScrollColumn = 17
    ActiveWindow.ScrollColumn = 16
    ActiveWindow.ScrollColumn = 15
    ActiveWindow.ScrollColumn = 14
    ActiveWindow.ScrollColumn = 13
    ActiveWindow.ScrollColumn = 12
    ActiveWindow.ScrollColumn = 11
    ActiveWindow.ScrollColumn = 10
    ActiveWindow.ScrollColumn = 9
    ActiveWindow.ScrollColumn = 8
    ActiveWindow.ScrollColumn = 7
    ActiveWindow.ScrollColumn = 6
    ActiveWindow.ScrollColumn = 5
    ActiveWindow.ScrollColumn = 4
    ActiveWindow.ScrollColumn = 3
    ActiveWindow.ScrollColumn = 2
    ActiveWindow.ScrollColumn = 1
    Range("A2").Select
     
    ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
    "Feuil1!R1C1:R1048576C44", Version:=xlPivotTableVersion12).CreatePivotTable _
    TableDestination:="", TableName:="Tableau croisé dynamique2", _
    DefaultVersion:=xlPivotTableVersion12
     
    With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields("Période" _
    )
    .Orientation = xlRowField
    .Position = 1
    End With
    With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields("Période" _
    )
    .Orientation = xlPageField
    .Position = 1
    End With
    With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields( _
    "Activité")
    .Orientation = xlRowField
    .Position = 1
    End With
    With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields( _
    "Domaine Fonctionnel ou Projet")
    .Orientation = xlRowField
    .Position = 2
    End With
    With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields( _
    "Domaine Fonctionnel ou Projet")
    .Orientation = xlColumnField
    .Position = 1
    End With
    With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields( _
    "Temps Total")
    .Orientation = xlRowField
    .Position = 2
    End With
    ActiveSheet.PivotTables("Tableau croisé dynamique2").AddDataField ActiveSheet. _
    PivotTables("Tableau croisé dynamique2").PivotFields("Temps Total"), _
    "Nombre de Temps Total", xlCount
    End Sub
    OUI j'ouvre mon classeur FAStime reporting ou un bouton permet d'activer la macro, qui commence par l'ouverture d' un autre classeur " base de données " situer dans le meme repertoire ( mais dont la lettre de réseau peut changer ! )

  19. #19
    Expert éminent


    Profil pro
    Inscrit en
    Juin 2003
    Messages
    14 008
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2003
    Messages : 14 008
    Par défaut
    ok mais tu as mal remplacé ton Y: tu dois voir dans l'explorateur windows le nom de partage et remplacer :

    Y:\FAStime\Technique\Ba....

    par

    \\MonServeur\MonPartage\FAStime\Technique\Ba

  20. #20
    Invité
    Invité(e)
    Par défaut
    si tu écris le chemin complet à ton fichier dans l'explorateur Windows et que tu appui sur Entrer, ton fichier devrait s’ouvrirNom : Sans titre.png
Affichages : 1032
Taille : 31,9 Ko

    si il ne s'ouvre pas c'est que tu n'as pas taper le bon chemin! dans ce cas il ne te reste plus qu'a le trouver avec l’explorateur Windows!

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

Discussions similaires

  1. Comment ouvrir un fichier excel avec une commande batch ?
    Par Alexandrebox dans le forum Scripts/Batch
    Réponses: 1
    Dernier message: 18/03/2010, 13h15
  2. Comment ouvrir un fichier .xla avec excel ?
    Par Australia dans le forum Macros et VBA Excel
    Réponses: 4
    Dernier message: 14/11/2006, 18h08
  3. Réponses: 3
    Dernier message: 23/09/2006, 15h19
  4. comment ouvrir un fichier XML avec excel
    Par ALCINA dans le forum XML/XSL et SOAP
    Réponses: 7
    Dernier message: 24/03/2006, 14h42
  5. ouvrir un fichier Excel avec une requete perso
    Par legillou dans le forum Access
    Réponses: 9
    Dernier message: 21/06/2005, 15h14

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