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 :

Bug Macro VBA, Selection=erreur 2036


Sujet :

Macros et VBA Excel

  1. #1
    Nouveau Candidat au Club
    Homme Profil pro
    Chargé d'affaire
    Inscrit en
    Mars 2011
    Messages
    1
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Chargé d'affaire
    Secteur : Finance

    Informations forums :
    Inscription : Mars 2011
    Messages : 1
    Points : 1
    Points
    1
    Par défaut Bug Macro VBA, Selection=erreur 2036
    Bonjour,

    J'ai un problème dans une macro, qui jusque la marchait parfaitement. je m'en sert tous les mois pour compiler et transformer plusieurs données en statistiques pour un suivi administratif. Le code bloc a la ligne tout en bas du code que je copie ci-dessous.
    Meerci de votre aide!!!!!

    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
    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
    Sub Dépassements()
     
    'mois = "12"
    'année = "2009"
     
    Workbooks.Open "S:\D_Dir_Commerciale\S_Cli_Priv\BUSINESS_MANAGER\Score card\" & année & "\Dépassement en jours et en montant\suivi débiteurs " & année & mois & ".xls"
     
    For Each Wb In Application.Workbooks
        If Wb.Name <> ThisWorkbook.Name Then
        If Wb.Name <> "RM.xls" Then
        If Wb.Name <> "suivi débiteurs " & année & mois & ".xls" Then
     
    Wb.Sheets("Crédit").Activate
     
    Cells(17, 1) = "Suivi des engagements : Dossiers de crédits échus et à échoir - Date de révision  " & mois & "-" & année
            Range("a17").Select
            Selection.Font.ColorIndex = 3
            Selection.Font.Bold = True
        With Selection.Font
            .Name = "Arial"
            .Size = 12
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .ColorIndex = 3
          End With
     
     
    Cells(17, 9) = "Suivi des Dépassements Global " & mois & "-" & année
            Range("i17").Select
            Selection.Font.ColorIndex = 3
            Selection.Font.Bold = True
        With Selection.Font
            .Name = "Arial"
            .Size = 12
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .ColorIndex = 3
          End With
     
    Range(Cells(21, 9), Cells(61, 17)).Select
        Selection.ClearContents
        Selection.Interior.ColorIndex = xlNone
        Selection.Borders(xlDiagonalDown).LineStyle = xlNone
        Selection.Borders(xlDiagonalUp).LineStyle = xlNone
        Selection.Borders(xlEdgeLeft).LineStyle = xlNone
        Selection.Borders(xlEdgeBottom).LineStyle = xlNone
            With Selection.Borders(xlEdgeTop)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
           End With
        'Selection.Borders(xlEdgeTop).LineStyle = xlNone
        Selection.Borders(xlEdgeRight).LineStyle = xlNone
        Selection.Borders(xlInsideVertical).LineStyle = xlNone
        Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
     
    Wb.Sheets("Crédit").Activate
     If mois = "01" Then
                Range(Cells(2, 10), Cells(2, 200)).ClearContents
                ElseIf mois = "02" Then
                Range(Cells(3, 10), Cells(3, 200)).ClearContents
                ElseIf mois = "03" Then
                Range(Cells(4, 10), Cells(4, 200)).ClearContents
                ElseIf mois = "04" Then
                Range(Cells(5, 10), Cells(5, 200)).ClearContents
                ElseIf mois = "05" Then
                Range(Cells(6, 10), Cells(6, 200)).ClearContents
                ElseIf mois = "06" Then
                Range(Cells(7, 10), Cells(7, 200)).ClearContents
                ElseIf mois = "07" Then
                Range(Cells(8, 10), Cells(8, 200)).ClearContents
                ElseIf mois = "08" Then
                Range(Cells(9, 10), Cells(9, 200)).ClearContents
                ElseIf mois = "09" Then
                Range(Cells(10, 10), Cells(10, 200)).ClearContents
                ElseIf mois = "10" Then
                Range(Cells(11, 10), Cells(11, 200)).ClearContents
                ElseIf mois = "11" Then
                Range(Cells(12, 10), Cells(12, 200)).ClearContents
                ElseIf mois = "12" Then
                Range(Cells(13, 10), Cells(13, 200)).ClearContents
            End If
     
     
    Wb.Sheets("Première partie").Activate
     
    Dim nombredébiteurs As Single
    Dim duréedébiteurs As Single
    Dim montantdébiteurs As Single
     
    ValeurAChercher = Cells(1, 1)
     
    nombredébiteurs = Application.WorksheetFunction.CountIf(Workbooks("suivi débiteurs " & année & mois & ".xls").Sheets("Depassement").Range("f:f"), ValeurAChercher)
    duréedébiteurs = Application.WorksheetFunction.SumIf(Workbooks("suivi débiteurs " & année & mois & ".xls").Sheets("Depassement").Range("f:f"), ValeurAChercher, Workbooks("suivi débiteurs " & année & mois & ".xls").Sheets("Depassement").Range("l:l"))
    montantdébiteurs = Application.WorksheetFunction.SumIf(Workbooks("suivi débiteurs " & année & mois & ".xls").Sheets("Depassement").Range("f:f"), ValeurAChercher, Workbooks("suivi débiteurs " & année & mois & ".xls").Sheets("Depassement").Range("n:n"))
     
    Dim h As Integer
    For h = 0 To 1000
     
    If ValeurAChercher = Workbooks("suivi débiteurs " & année & mois & ".xls").Sheets("Depassement").Cells(14 + h, 6) Then
     
    Workbooks("suivi débiteurs " & année & mois & ".xls").Sheets("Depassement").Activate
    Cells(14 + h, 14).Select
     
    Selection.Copy
     
    Wb.Sheets("Crédit").Activate
     
    If mois = "01" Then
     
    Range("C2").Select
        ActiveCell.FormulaR1C1 = "=MEDIAN(RC[7]:RC[45])"
     
                    For p = 0 To 100
                     If Cells(2, 10 + p) = "" Then
                        Cells(2, 10 + p).Select
                        Exit For
                    End If
                    Next p
     
                ElseIf mois = "02" Then
     
                Range("C3").Select
        ActiveCell.FormulaR1C1 = "=MEDIAN(RC[7]:RC[45])"
                         For q = 0 To 100
                     If Cells(3, 10 + q) = "" Then
                        Cells(3, 10 + q).Select
                        Exit For
                    End If
                    Next q
     
     
                ElseIf mois = "03" Then
     
     
    Range("C4").Select
        ActiveCell.FormulaR1C1 = "=MEDIAN(RC[7]:RC[45])"
     
                    For r = 0 To 100
                     If Cells(4, 10 + r) = "" Then
                        Cells(4, 10 + r).Select
                        Exit For
                    End If
                    Next r
     
     
                ElseIf mois = "04" Then
     
     
    Range("C5").Select
        ActiveCell.FormulaR1C1 = "=MEDIAN(RC[7]:RC[45])"
     
                     For S = 0 To 100
                     If Cells(5, 10 + S) = "" Then
                        Cells(5, 10 + S).Select
                        Exit For
                    End If
                    Next S
     
     
     
                ElseIf mois = "05" Then
     
                Range("C6").Select
        ActiveCell.FormulaR1C1 = "=MEDIAN(RC[7]:RC[45])"
     
                         For t = 0 To 100
                     If Cells(6, 10 + t) = "" Then
                        Cells(6, 10 + t).Select
                        Exit For
                    End If
                    Next t
     
     
     
                ElseIf mois = "06" Then
     
     
                Range("C7").Select
        ActiveCell.FormulaR1C1 = "=MEDIAN(RC[7]:RC[45])"
                        For u = 0 To 100
                     If Cells(7, 10 + u) = "" Then
                        Cells(7, 10 + u).Select
                        Exit For
                    End If
                    Next u
     
     
     
                ElseIf mois = "07" Then
     
                Range("C8").Select
        ActiveCell.FormulaR1C1 = "=MEDIAN(RC[7]:RC[45])"
     
                                For v = 0 To 100
                     If Cells(8, 10 + v) = "" Then
                        Cells(8, 10 + v).Select
                        Exit For
                    End If
                    Next v
     
     
                ElseIf mois = "08" Then
     
                Range("C9").Select
        ActiveCell.FormulaR1C1 = "=MEDIAN(RC[7]:RC[45])"
     
                         For w = 0 To 100
                     If Cells(9, 10 + w) = "" Then
                        Cells(9, 10 + w).Select
                        Exit For
                    End If
                    Next w
     
     
                ElseIf mois = "09" Then
     
                Range("C10").Select
        ActiveCell.FormulaR1C1 = "=MEDIAN(RC[7]:RC[45])"
     
                           For x = 0 To 100
                     If Cells(10, 10 + x) = "" Then
                        Cells(10, 10 + x).Select
                        Exit For
                    End If
                    Next x
     
     
                ElseIf mois = "10" Then
     
                Range("C11").Select
        ActiveCell.FormulaR1C1 = "=MEDIAN(RC[7]:RC[45])"
     
     
                          For y = 0 To 100
                     If Cells(11, 10 + y) = "" Then
                        Cells(11, 10 + y).Select
                        Exit For
                    End If
                    Next y
     
     
                ElseIf mois = "11" Then
     
                Range("C12").Select
        ActiveCell.FormulaR1C1 = "=MEDIAN(RC[7]:RC[45])"
     
                    For z = 0 To 100
                     If Cells(12, 10 + z) = "" Then
                        Cells(12, 10 + z).Select
                        Exit For
                    End If
                    Next z
     
     
                ElseIf mois = "12" Then
     
     
                Range("C13").Select
        ActiveCell.FormulaR1C1 = "=MEDIAN(RC[7]:RC[45])"
     
                             For a = 0 To 100
                     If Cells(13, 10 + a) = "" Then
                        Cells(13, 10 + a).Select
                        Exit For
                    End If
                    Next a
     
     
            End If
     
    ActiveSheet.Paste
     
    Else
    Wb.Sheets("Crédit").Activate
    If mois = "01" Then
                Cells(2, 4).Select
                ElseIf mois = "02" Then
                Cells(3, 4).Select
                ElseIf mois = "03" Then
                Cells(4, 4).Select
                ElseIf mois = "04" Then
                Cells(5, 4).Select
                ElseIf mois = "05" Then
                Cells(6, 4).Select
                ElseIf mois = "06" Then
                Cells(7, 4).Select
                ElseIf mois = "07" Then
                Cells(8, 4).Select
                ElseIf mois = "08" Then
                Cells(9, 4).Select
                ElseIf mois = "09" Then
                Cells(10, 4).Select
                ElseIf mois = "10" Then
                Cells(11, 4).Select
                ElseIf mois = "11" Then
                Cells(12, 4).Select
                ElseIf mois = "12" Then
                Cells(13, 4).Select
           End If
     
    Selection = "0"
     
    End If
     
    Next h
     
    Dim b As Integer
    For b = 0 To 1000
     
    If ValeurAChercher = Workbooks("suivi débiteurs " & année & mois & ".xls").Sheets("Depassement").Cells(14 + b, 6) Then
     
    Workbooks("suivi débiteurs " & année & mois & ".xls").Sheets("Depassement").Activate
    Cells(14 + b, 12).Select
     
    Selection.Copy
     
    Wb.Sheets("Crédit").Activate
     
     
    If mois = "01" Then
     
    Range("d2").Select
        ActiveCell.FormulaR1C1 = "=MEDIAN(RC[46]:RC[100])"
     
                    For p = 0 To 100
                     If Cells(2, 50 + p) = "" Then
                        Cells(2, 50 + p).Select
                        Exit For
                    End If
                    Next p
     
                ElseIf mois = "02" Then
     
                Range("d3").Select
        ActiveCell.FormulaR1C1 = "=MEDIAN(RC[46]:RC[100])"
                         For q = 0 To 100
                     If Cells(3, 50 + q) = "" Then
                        Cells(3, 50 + q).Select
                        Exit For
                    End If
                    Next q
     
     
                ElseIf mois = "03" Then
     
     
    Range("d4").Select
        ActiveCell.FormulaR1C1 = "=MEDIAN(RC[46]:RC[100])"
     
                    For r = 0 To 100
                     If Cells(4, 50 + r) = "" Then
                        Cells(4, 50 + r).Select
                        Exit For
                    End If
                    Next r
     
     
                ElseIf mois = "04" Then
     
     
    Range("d5").Select
        ActiveCell.FormulaR1C1 = "=MEDIAN(RC[46]:RC[100])"
     
                     For S = 0 To 100
                     If Cells(5, 50 + S) = "" Then
                        Cells(5, 50 + S).Select
                        Exit For
                    End If
                    Next S
     
     
     
                ElseIf mois = "05" Then
     
                Range("d6").Select
        ActiveCell.FormulaR1C1 = "=MEDIAN(RC[46]:RC[100])"
     
                         For t = 0 To 100
                     If Cells(6, 50 + t) = "" Then
                        Cells(6, 50 + t).Select
                        Exit For
                    End If
                    Next t
     
     
     
                ElseIf mois = "06" Then
     
     
                Range("d7").Select
        ActiveCell.FormulaR1C1 = "=MEDIAN(RC[46]:RC[100])"
                        For u = 0 To 100
                     If Cells(7, 50 + u) = "" Then
                        Cells(7, 50 + u).Select
                        Exit For
                    End If
                    Next u
     
     
     
                ElseIf mois = "07" Then
     
                Range("d8").Select
        ActiveCell.FormulaR1C1 = "=MEDIAN(RC[46]:RC[100])"
     
                                For v = 0 To 100
                     If Cells(8, 50 + v) = "" Then
                        Cells(8, 50 + v).Select
                        Exit For
                    End If
                    Next v
     
     
                ElseIf mois = "08" Then
     
                Range("d9").Select
        ActiveCell.FormulaR1C1 = "=MEDIAN(RC[46]:RC[100])"
     
                         For w = 0 To 100
                     If Cells(9, 50 + w) = "" Then
                        Cells(9, 50 + w).Select
                        Exit For
                    End If
                    Next w
     
     
                ElseIf mois = "09" Then
     
                Range("d10").Select
        ActiveCell.FormulaR1C1 = "=MEDIAN(RC[46]:RC[100])"
     
                           For x = 0 To 100
                     If Cells(10, 50 + x) = "" Then
                        Cells(10, 50 + x).Select
                        Exit For
                    End If
                    Next x
     
     
                ElseIf mois = "10" Then
     
                Range("d11").Select
        ActiveCell.FormulaR1C1 = "=MEDIAN(RC[46]:RC[100])"
     
     
                          For y = 0 To 100
                     If Cells(11, 50 + y) = "" Then
                        Cells(11, 50 + y).Select
                        Exit For
                    End If
                    Next y
     
     
                ElseIf mois = "11" Then
     
                Range("d12").Select
        ActiveCell.FormulaR1C1 = "=MEDIAN(RC[46]:RC[100])"
     
                    For z = 0 To 100
                     If Cells(12, 50 + z) = "" Then
                        Cells(12, 50 + z).Select
                        Exit For
                    End If
                    Next z
     
     
                ElseIf mois = "12" Then
     
     
                Range("d13").Select
        ActiveCell.FormulaR1C1 = "=MEDIAN(RC[46]:RC[100])"
     
                             For a = 0 To 100
                     If Cells(13, 50 + a) = "" Then
                        Cells(13, 50 + a).Select
                        Exit For
                    End If
                    Next a
     
     
            End If
     
    ActiveSheet.Paste
     
    End If
     
    Next b
     
    Wb.Sheets("Crédit").Activate
     
     If mois = "01" Then
                Cells(2, 2).Select
                ElseIf mois = "02" Then
                Cells(3, 2).Select
                ElseIf mois = "03" Then
                Cells(4, 2).Select
                ElseIf mois = "04" Then
                Cells(5, 2).Select
                ElseIf mois = "05" Then
                Cells(6, 2).Select
                ElseIf mois = "06" Then
                Cells(7, 2).Select
                ElseIf mois = "07" Then
                Cells(8, 2).Select
                ElseIf mois = "08" Then
                Cells(9, 2).Select
                ElseIf mois = "09" Then
                Cells(10, 2).Select
                ElseIf mois = "10" Then
                Cells(11, 2).Select
                ElseIf mois = "11" Then
                Cells(12, 2).Select
                ElseIf mois = "12" Then
                Cells(13, 2).Select
            End If
     
    Selection = nombredébiteurs
     
     
    Wb.Sheets("Crédit").Activate
     
     If mois = "01" Then
                Cells(2, 3).Select
                Selection = Abs(Selection)
     
     
     
                ElseIf mois = "02" Then
                Cells(3, 3).Select
                Selection = Abs(Selection)
     
     
                ElseIf mois = "03" Then
                Cells(4, 3).Select
                Selection = Abs(Selection)
     
     
                ElseIf mois = "04" Then
                Cells(5, 3).Select
                Selection = Abs(Selection)
     
     
                ElseIf mois = "05" Then
                Cells(6, 3).Select
                Selection = Abs(Selection)
     
     
                ElseIf mois = "06" Then
                Cells(7, 3).Select
                Selection = Abs(Selection)
     
                ElseIf mois = "07" Then
                Cells(8, 3).Select
                Selection = Abs(Selection)
     
     
                ElseIf mois = "08" Then
                Cells(9, 3).Select
                Selection = Abs(Selection)
     
     
                ElseIf mois = "09" Then
                Cells(10, 3).Select
                Selection = Abs(Selection)
     
     
                ElseIf mois = "10" Then
                Cells(11, 3).Select
                Selection = Abs(Selection)
     
     
                ElseIf mois = "11" Then
                Cells(12, 3).Select
                Selection = Abs(Selection)
     
     
                ElseIf mois = "12" Then
                Cells(13, 3).Select
                Selection = Abs(Selection) '<== Erreur ici

  2. #2
    Membre chevronné Avatar de wilfried_42
    Homme Profil pro
    Auto-entrepreneur
    Inscrit en
    Novembre 2006
    Messages
    1 427
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 62
    Localisation : France, Vendée (Pays de la Loire)

    Informations professionnelles :
    Activité : Auto-entrepreneur
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2006
    Messages : 1 427
    Points : 1 900
    Points
    1 900
    Par défaut
    Bonjour

    toutes ces lignes :
    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
    If mois = "01" Then
    Cells(2, 3).Select
    Selection = Abs(Selection)
     
     
     
    ElseIf mois = "02" Then
    Cells(3, 3).Select
    Selection = Abs(Selection)
     
     
    ElseIf mois = "03" Then
    Cells(4, 3).Select
    Selection = Abs(Selection)
     
     
    ElseIf mois = "04" Then
    Cells(5, 3).Select
    Selection = Abs(Selection)
     
     
    ElseIf mois = "05" Then
    Cells(6, 3).Select
    Selection = Abs(Selection)
     
     
    ElseIf mois = "06" Then
    Cells(7, 3).Select
    Selection = Abs(Selection)
     
    ElseIf mois = "07" Then
    Cells(8, 3).Select
    Selection = Abs(Selection)
     
     
    ElseIf mois = "08" Then
    Cells(9, 3).Select
    Selection = Abs(Selection)
     
     
    ElseIf mois = "09" Then
    Cells(10, 3).Select
    Selection = Abs(Selection)
     
     
    ElseIf mois = "10" Then
    Cells(11, 3).Select
    Selection = Abs(Selection)
     
     
    ElseIf mois = "11" Then
    Cells(12, 3).Select
    Selection = Abs(Selection)
     
     
    ElseIf mois = "12" Then
    Cells(13, 3).Select
    Selection = Abs(Selection)
    deviennent pour plus de facilité :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Cells(1 + val(mois),3) = Abs(cell(1 + val(mois),3))
    sinon, vérifie que ta cellule contienne bien des valeurs numériques

  3. #3
    Expert éminent Avatar de casefayere
    Homme Profil pro
    RETRAITE
    Inscrit en
    Décembre 2006
    Messages
    5 138
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 70
    Localisation : France, Ardennes (Champagne Ardenne)

    Informations professionnelles :
    Activité : RETRAITE
    Secteur : Agroalimentaire - Agriculture

    Informations forums :
    Inscription : Décembre 2006
    Messages : 5 138
    Points : 9 548
    Points
    9 548
    Par défaut
    J'ajouterais,
    1 - n'oublies pas les balises codes
    2 - apprends a indenter ton code
    3 - supprimes les lignes qui ne servent à rien

    exemple
    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
    Sub Dépassements()
     
    'mois = "12"
    'année = "2009"
     
    Workbooks.Open "S:\D_Dir_Commerciale\S_Cli_Priv\BUSINESS_MANAGER\Score card\" & année & "\Dépassement en jours et en montant\suivi débiteurs " & année & mois & ".xls"
     
    For Each Wb In Application.Workbooks
        If Wb.Name <> ThisWorkbook.Name Then
            If Wb.Name <> "RM.xls" Then
                If Wb.Name <> "suivi débiteurs " & année & mois & ".xls" Then
                    Wb.Sheets("Crédit").Activate
                    Cells(17, 1) = "Suivi des engagements : Dossiers de crédits échus et à échoir - Date de révision " & mois & "-" & année
                    With Range("a17").Font
                        .Name = "Arial"
                        .Bold = True
                        .Size = 12
                        .Strikethrough = False
                        .Superscript = False
                        .Subscript = False
                        .OutlineFont = False
                        .Shadow = False
                        .Underline = xlUnderlineStyleNone
                        .ColorIndex = 3
                    End With
                    Cells(17, 9) = "Suivi des Dépassements Global " & mois & "-" & année
                    With Range("i17").Font
                        .ColorIndex = 3
                        .Bold = True
                        .Name = "Arial"
                        .Size = 12
                        .Strikethrough = False
                        .Superscript = False
                        .Subscript = False
                        .OutlineFont = False
                        .Shadow = False
                        .Underline = xlUnderlineStyleNone
                    End With
                    With Range(Cells(21, 9), Cells(61, 17))
                        .ClearContents
                        .Interior.ColorIndex = xlNone
                        .Borders(xlDiagonalDown).LineStyle = xlNone
                        .Borders(xlDiagonalUp).LineStyle = xlNone
                        .Borders(xlEdgeLeft).LineStyle = xlNone
                        .Borders(xlEdgeBottom).LineStyle = xlNone
                    End With
    .........et ainsi de suite
    ton problème sera peut-etre plus criant

Discussions similaires

  1. Réponses: 3
    Dernier message: 06/10/2014, 17h46
  2. [XL-2007] Macro VBA RechercheV / Erreur
    Par Yamiral dans le forum Macros et VBA Excel
    Réponses: 8
    Dernier message: 22/08/2013, 09h28
  3. Macro VBA "Selection.Offset"
    Par Neliso dans le forum Macros et VBA Excel
    Réponses: 3
    Dernier message: 11/02/2012, 14h47
  4. [VBA-E] Bug macro bouton commande
    Par allergique dans le forum Macros et VBA Excel
    Réponses: 2
    Dernier message: 14/08/2006, 23h00
  5. probleme de selection aleatoire sur excel avec macro vba
    Par guillaume sors dans le forum Macros et VBA Excel
    Réponses: 1
    Dernier message: 21/10/2005, 10h51

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