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 :

erreur 91 variable objet non définie [XL-2003]


Sujet :

Macros et VBA Excel

  1. #1
    Membre éclairé
    Homme Profil pro
    autodidacte
    Inscrit en
    Novembre 2013
    Messages
    517
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : autodidacte
    Secteur : Industrie

    Informations forums :
    Inscription : Novembre 2013
    Messages : 517
    Points : 684
    Points
    684
    Par défaut erreur 91 variable objet non définie
    bonjour, je viens vers vous car je ne comprend pas le pb:

    SOus excel 2010 tout fonctionne parfaitement. (le fichier est enregistrer en .xls classeur excel 97-2003)
    Sous Excel 2003 il y a un message d'erreur 91 variable objet ou variable de bloc with non défini:

    je ne comrpend pas pourquoi. POuvez-vous m'aider svp:

    voici mon code:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    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
    '==================================================
    ' Affichage Rupture CQ
    '==================================================
    Sub Liste_Rupture()
    Dim DATE_JOUR
    Dim DL_TF As Long
    Dim DL_PETRI As Long
    Dim DL_MS As Long
    Dim DL_APPRO As Long
    Dim DL_RUPTURE As Long
    Dim monTab() As Variant
     
     
     
    ' suppression des filtres
     
    If ThisWorkbook.Sheets("Liste T&F").AutoFilterMode = True Then
       ThisWorkbook.Sheets("Liste T&F").AutoFilterMode = False
    End If
    If ThisWorkbook.Sheets("Liste PETRI").AutoFilterMode = True Then
       ThisWorkbook.Sheets("Liste PETRI").AutoFilterMode = False
    End If
    If ThisWorkbook.Sheets("Liste Appro Marcy").AutoFilterMode = True Then
       ThisWorkbook.Sheets("Liste Appro Marcy").AutoFilterMode = False
    End If
    If ThisWorkbook.Sheets("Liste Milieu Sec").AutoFilterMode = True Then
       ThisWorkbook.Sheets("Liste Milieu Sec").AutoFilterMode = False
    End If
    If ThisWorkbook.Sheets("Rupture").AutoFilterMode = True Then
       ThisWorkbook.Sheets("Rupture").AutoFilterMode = False
    End If
     
    'remise à 0 de Rupture
    DL_RUPTURE = ThisWorkbook.Worksheets("Rupture").Cells(Rows.Count, 1).End(xlUp).Row
    If DL_RUPTURE <> 1 Then
    ThisWorkbook.Worksheets("Rupture").Range("A2:F" & DL_RUPTURE).ClearContents
    ThisWorkbook.Worksheets("Rupture").Range("A2:A" & DL_RUPTURE).Font.Bold = False
    End If
     
    DATE_JOUR = Date
    DL_TF = ThisWorkbook.Worksheets("Liste T&F").Cells(Rows.Count, 3).End(xlUp).Row
    DL_PETRI = ThisWorkbook.Worksheets("Liste PETRI").Cells(Rows.Count, 3).End(xlUp).Row
    DL_MS = ThisWorkbook.Worksheets("Liste Milieu Sec").Cells(Rows.Count, 3).End(xlUp).Row
    DL_APPRO = ThisWorkbook.Worksheets("Liste Appro Marcy").Cells(Rows.Count, 3).End(xlUp).Row
    DL_RUPTURE = ThisWorkbook.Worksheets("Rupture").Columns("B").Find("", , , , xlByColumns, xlNext).Row
    't&f
    DL_RUPTURE = ThisWorkbook.Worksheets("Rupture").Columns("A").Find("", , , , xlByColumns, xlNext).Row
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 1) = "Rupture T&F"
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 1).Font.Bold = True
    monTab() = ThisWorkbook.Worksheets("Liste T&F").Range("A3:AM" & DL_TF).Value
    For i = LBound(monTab, 1) To UBound(monTab, 1)
    If (monTab(i, 24) = "" And (monTab(i, 4) = "Rupture" Or monTab(i, 4) = "Critique")) And ((monTab(i, 11) = "" And monTab(i, 10) <= DATE_JOUR) Or (monTab(i, 21) = "" And monTab(i, 20) <= DATE_JOUR)) Then
    DL_RUPTURE = ThisWorkbook.Worksheets("Rupture").Columns("A").Find("", , , , xlByColumns, xlNext).Row
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 1) = monTab(i, 1)
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 2) = monTab(i, 3)
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 3) = monTab(i, 4)
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 4) = monTab(i, 10)
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 5) = monTab(i, 20)
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 6) = monTab(i, 2)
    If monTab(i, 11) <> "" Or monTab(i, 5) = "N/A" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 4) = "Stérilité terminée"
    End If
    If monTab(i, 21) <> "" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 5) = "Activité terminée"
    End If
    If monTab(i, 5) = "" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 4) = "Pas d'infos Stérilité"
    End If
    If monTab(i, 17) = "" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 5) = "Pas d'infos Activité"
    End If
    End If
    Next i
    Erase monTab
    'petri
    DL_RUPTURE = ThisWorkbook.Worksheets("Rupture").Columns("A").Find("", , , , xlByColumns, xlNext).Row
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 1) = "Rupture PETRI"
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 1).Font.Bold = True
    monTab() = ThisWorkbook.Worksheets("Liste PETRI").Range("A3:AC" & DL_PETRI).Value
    For i = LBound(monTab, 1) To UBound(monTab, 1)
    If (monTab(i, 21) = "" And (monTab(i, 4) = "Rupture" Or monTab(i, 4) = "Critique")) And ((monTab(i, 8) = "" And monTab(i, 7) <= DATE_JOUR) Or (monTab(i, 18) = "" And monTab(i, 17) <= DATE_JOUR)) Then
    DL_RUPTURE = ThisWorkbook.Worksheets("Rupture").Columns("A").Find("", , , , xlByColumns, xlNext).Row
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 1) = monTab(i, 1)
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 2) = monTab(i, 3)
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 3) = monTab(i, 4)
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 4) = monTab(i, 7)
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 5) = monTab(i, 17)
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 6) = monTab(i, 2)
    If monTab(i, 8) <> "" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 4) = "Stérilité terminée"
    End If
    If monTab(i, 18) <> "" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 5) = "Activité terminée"
    End If
    If monTab(i, 5) = "" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 4) = "Pas d'infos Stérilité"
    End If
    If monTab(i, 14) = "" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 5) = "Pas d'infos Activité"
    End If
    End If
    Next i
    Erase monTab
    'MS
    DL_RUPTURE = ThisWorkbook.Worksheets("Rupture").Columns("A").Find("", , , , xlByColumns, xlNext).Row
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 1) = "Rupture Milieu Sec"
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 1).Font.Bold = True
    monTab() = ThisWorkbook.Worksheets("Liste Milieu Sec").Range("A3:AK" & DL_MS).Value
    For i = LBound(monTab, 1) To UBound(monTab, 1)
    If monTab(i, 29) = "" And (monTab(i, 4) = "Rupture" Or monTab(i, 4) = "Critique") And ((monTab(i, 11) <> "N" And monTab(i, 15) = "" And monTab(i, 14) <= DATE_JOUR) Or (monTab(i, 20) <> "N" And monTab(i, 26) = "" And monTab(i, 25) <= DATE_JOUR)) Then
    DL_RUPTURE = ThisWorkbook.Worksheets("Rupture").Columns("A").Find("", , , , xlByColumns, xlNext).Row 'ligne qui bug....
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 1) = monTab(i, 1)
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 2) = monTab(i, 3)
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 3) = monTab(i, 4)
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 4) = monTab(i, 14)
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 5) = monTab(i, 25)
    If monTab(i, 11) = "N" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 4) = "Pas de Stérilité"
    End If
    If monTab(i, 20) = "N" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 5) = "Pas d'activité"
    End If
    If monTab(i, 11) = "O" Then
    If monTab(i, 15) <> "" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 4) = "Stérilité terminée"
    End If
    If monTab(i, 12) = "" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 4) = "Pas d'infos Stérilité"
    End If
    End If
    If monTab(i, 20) = "O" Then
    If monTab(i, 26) <> "" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 5) = "Activité terminée"
    End If
    If monTab(i, 22) = "" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 5) = "Pas d'infos Activité"
    End If
    End If
    End If
    Next i
    Erase monTab
    'Appro
    DL_RUPTURE = ThisWorkbook.Worksheets("Rupture").Columns("A").Find("", , , , xlByColumns, xlNext).Row
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 1) = "Rupture Appro Marcy"
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 1).Font.Bold = True
    monTab() = ThisWorkbook.Worksheets("Liste Appro Marcy").Range("A3:AK" & DL_APPRO).Value
    For i = LBound(monTab, 1) To UBound(monTab, 1)
    If monTab(i, 29) = "" And (monTab(i, 4) = "Rupture" Or monTab(i, 4) = "Critique") And ((monTab(i, 11) <> "N" And monTab(i, 15) = "" And monTab(i, 14) <= DATE_JOUR) Or (monTab(i, 20) <> "N" And monTab(i, 26) = "" And monTab(i, 25) <= DATE_JOUR)) Then
    DL_RUPTURE = ThisWorkbook.Worksheets("Rupture").Columns("A").Find("", , , , xlByColumns, xlNext).Row
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 1) = monTab(i, 1)
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 2) = monTab(i, 3)
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 3) = monTab(i, 4)
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 4) = monTab(i, 14)
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 5) = monTab(i, 25)
    If monTab(i, 11) = "N" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 4) = "Pas de Stérilité"
    End If
    If monTab(i, 20) = "N" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 5) = "Pas d'activité"
    End If
    If monTab(i, 11) = "O" Then
    If monTab(i, 15) <> "" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 4) = "Stérilité terminée"
    End If
    If monTab(i, 12) = "" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 4) = "Pas d'infos Stérilité"
    End If
    End If
    If monTab(i, 20) = "O" Then
    If monTab(i, 26) <> "" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 5) = "Activité terminée"
    End If
    If monTab(i, 22) = "" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 5) = "Pas d'infos Activité"
    End If
    End If
    End If
    Next i
    Erase monTab
     
    ' remise des filtres
    If ThisWorkbook.Sheets("Liste T&F").AutoFilterMode = False Then
       ThisWorkbook.Worksheets("Liste T&F").Range("A2:AM2").AutoFilter
    End If
    If ThisWorkbook.Sheets("Liste PETRI").AutoFilterMode = False Then
       ThisWorkbook.Worksheets("Liste PETRI").Range("A2:AC2").AutoFilter
    End If
    If ThisWorkbook.Sheets("Liste Appro Marcy").AutoFilterMode = False Then
       ThisWorkbook.Worksheets("Liste Appro Marcy").Range("A2:AK2").AutoFilter
    End If
    If ThisWorkbook.Sheets("Liste Milieu Sec").AutoFilterMode = False Then
       ThisWorkbook.Worksheets("Liste Milieu Sec").Range("A2:AK2").AutoFilter
    End If
    If ThisWorkbook.Sheets("Rupture").AutoFilterMode = False Then
       ThisWorkbook.Worksheets("Rupture").Range("A1:F1").AutoFilter
    End If
     
     
    ThisWorkbook.Worksheets("Rupture").Activate
    ThisWorkbook.Worksheets("Rupture").Range("A1").Select
     
    End Sub
    c'est le même de partout sauf que ca change de feuille a chaque fois. et ca plante à la ligne:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    DL_RUPTURE = ThisWorkbook.Worksheets("Rupture").Columns("A").Find("", , , , xlByColumns, xlNext).Row
    le DL_RUPTURE bug pour la partie MS. du code uniquement je ne comprend pas pourquoi....

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    'MS
    DL_RUPTURE = ThisWorkbook.Worksheets("Rupture").Columns("A").Find("", , , , xlByColumns, xlNext).Row
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 1) = "Rupture Milieu Sec"
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 1).Font.Bold = True
    monTab() = ThisWorkbook.Worksheets("Liste Milieu Sec").Range("A3:AK" & DL_MS).Value
    For i = LBound(monTab, 1) To UBound(monTab, 1)
    If monTab(i, 29) = "" And (monTab(i, 4) = "Rupture" Or monTab(i, 4) = "Critique") And ((monTab(i, 11) <> "N" And monTab(i, 15) = "" And monTab(i, 14) <= DATE_JOUR) Or (monTab(i, 20) <> "N" And monTab(i, 26) = "" And monTab(i, 25) <= DATE_JOUR)) Then
    DL_RUPTURE = ThisWorkbook.Worksheets("Rupture").Columns("A").Find("", , , , xlByColumns, xlNext).Row 'cette ligne bug

    merci de votre aide
    Merci de cliquer sur pour chaque message vous ayant aidé
    puis sur pour clore cette discussion …

    C'est en récoltant les cailloux qu'on te jette que tu construiras ta future estrade...

  2. #2
    Membre expérimenté
    Homme Profil pro
    Ingénieur développement matériel électronique
    Inscrit en
    Septembre 2013
    Messages
    783
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Ingénieur développement matériel électronique
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Septembre 2013
    Messages : 783
    Points : 1 562
    Points
    1 562
    Par défaut
    Bonjour,

    Je regarderai bien du côté des arguments du find entre 2003 et 2010
    Si le find ne marche pas, le range retourné est vide, donc le row est en erreur je pense. A moins que ROW ne soit pas un double sous 2003?
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    DL_RUPTURE = ThisWorkbook.Worksheets("Rupture").Columns("A").Find("", , , , xlByColumns, xlNext).Row
    Je rajouterai bien juste avant

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    Set TestRng = ThisWorkbook.Worksheets("Rupture").Columns("A").Find("", , , , xlByColumns, xlNext)
    Debug.Print  IsObject(TestRng), TestRng.Address
    PS: vous auriez vraiment intérêt à définir les feuilles que vous appelez dans un tableau .... suggestion,

    WshNAR = ("Liste T&F","Liste PETRI","Liste Appro Marcy")
    "Idéalement nous sommes ce que nous pensons. Dans la réalité, nous sommes ce que nous accomplissons." A.Senna
    et n'oubliez-pas de développer des .... sourires ^_^

  3. #3
    Membre émérite Avatar de antonysansh
    Homme Profil pro
    Chargé d'études RH
    Inscrit en
    Mai 2014
    Messages
    1 115
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 32
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Chargé d'études RH
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2014
    Messages : 1 115
    Points : 2 439
    Points
    2 439
    Par défaut
    Bonjour bboy-eazy,

    Si ThisWorkbook.Worksheets("Rupture").Columns("A").Find("", , , , xlByColumns, xlNext) renvoie Nothing,
    avec ThisWorkbook.Worksheets("Rupture").Columns("A").Find("", , , , xlByColumns, xlNext).Row tu as exactement le mesasge d'erreur 91.

    Tu peux tester :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    If Not ThisWorkbook.Worksheets("Rupture").Columns("A").Find("", , , , xlByColumns, xlNext) Is Nothing Then
        '...
    Else
        'Suite du code
    Antony

    Mieux vaut ne rien dire et passer pour un con que de l'ouvrir et ne laisser aucun doute à ce sujet.
    Gustave Parking


    Si le post vous est utile un petit fait toujours plaisir et pensez à passer en

    Et surtout -> Balise CODE

  4. #4
    Membre chevronné
    Inscrit en
    Août 2006
    Messages
    1 588
    Détails du profil
    Informations forums :
    Inscription : Août 2006
    Messages : 1 588
    Points : 2 178
    Points
    2 178
    Par défaut
    Bonjour,
    La syntaxe de la ligne 111 est correcte mais il faut s'assurer qu'une valeur est retournée par
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     
    If Not DL_RUPTURE Is Nothing Then 
      'OK
    else
      'NOK : pas trouvé
    Endif

  5. #5
    Membre éclairé
    Homme Profil pro
    autodidacte
    Inscrit en
    Novembre 2013
    Messages
    517
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : autodidacte
    Secteur : Industrie

    Informations forums :
    Inscription : Novembre 2013
    Messages : 517
    Points : 684
    Points
    684
    Par défaut
    Bonjour,

    merci pour ta réponse je vais regardé ca de plus pret alors je reviens dès que c'est fait. Mais c'est bizarre car pourquoi seul ce find ne fonctionne pas et tous les autres oui...


    mais je suis pas sur car si j'enlève la partie d'avant donc la procédure pour t&F et petri, et que je laisse la fin du code donc ce 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
    ==================================================
    ' Affichage Rupture CQ
    '==================================================
    Sub Liste_Rupture()
    Dim DATE_JOUR
    Dim DL_TF As Long
    Dim DL_PETRI As Long
    Dim DL_MS As Long
    Dim DL_APPRO As Long
    Dim DL_RUPTURE As Long
    Dim monTab() As Variant
     
     
     
    ' suppression des filtres
     
    If ThisWorkbook.Sheets("Liste T&F").AutoFilterMode = True Then
       ThisWorkbook.Sheets("Liste T&F").AutoFilterMode = False
    End If
    If ThisWorkbook.Sheets("Liste PETRI").AutoFilterMode = True Then
       ThisWorkbook.Sheets("Liste PETRI").AutoFilterMode = False
    End If
    If ThisWorkbook.Sheets("Liste Appro Marcy").AutoFilterMode = True Then
       ThisWorkbook.Sheets("Liste Appro Marcy").AutoFilterMode = False
    End If
    If ThisWorkbook.Sheets("Liste Milieu Sec").AutoFilterMode = True Then
       ThisWorkbook.Sheets("Liste Milieu Sec").AutoFilterMode = False
    End If
    If ThisWorkbook.Sheets("Rupture").AutoFilterMode = True Then
       ThisWorkbook.Sheets("Rupture").AutoFilterMode = False
    End If
     
    'remise à 0 de Rupture
    DL_RUPTURE = ThisWorkbook.Worksheets("Rupture").Cells(Rows.Count, 1).End(xlUp).Row
    If DL_RUPTURE <> 1 Then
    ThisWorkbook.Worksheets("Rupture").Range("A2:F" & DL_RUPTURE).ClearContents
    ThisWorkbook.Worksheets("Rupture").Range("A2:A" & DL_RUPTURE).Font.Bold = False
    End If
     
    DATE_JOUR = Date
    DL_TF = ThisWorkbook.Worksheets("Liste T&F").Cells(Rows.Count, 3).End(xlUp).Row
    DL_PETRI = ThisWorkbook.Worksheets("Liste PETRI").Cells(Rows.Count, 3).End(xlUp).Row
    DL_MS = ThisWorkbook.Worksheets("Liste Milieu Sec").Cells(Rows.Count, 3).End(xlUp).Row
    DL_APPRO = ThisWorkbook.Worksheets("Liste Appro Marcy").Cells(Rows.Count, 3).End(xlUp).Row
    DL_RUPTURE = ThisWorkbook.Worksheets("Rupture").Columns("B").Find("", , , , xlByColumns, xlNext).Row
     
    'MS
    DL_RUPTURE = ThisWorkbook.Worksheets("Rupture").Columns("A").Find("", , , , xlByColumns, xlNext).Row
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 1) = "Rupture Milieu Sec"
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 1).Font.Bold = True
    monTab() = ThisWorkbook.Worksheets("Liste Milieu Sec").Range("A3:AK" & DL_MS).Value
    For i = LBound(monTab, 1) To UBound(monTab, 1)
    If monTab(i, 29) = "" And (monTab(i, 4) = "Rupture" Or monTab(i, 4) = "Critique") And ((monTab(i, 11) <> "N" And monTab(i, 15) = "" And monTab(i, 14) <= DATE_JOUR) Or (monTab(i, 20) <> "N" And monTab(i, 26) = "" And monTab(i, 25) <= DATE_JOUR)) Then
    DL_RUPTURE = ThisWorkbook.Worksheets("Rupture").Columns("A").Find("", , , , xlByColumns, xlNext).Row
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 1) = monTab(i, 1)
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 2) = monTab(i, 3)
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 3) = monTab(i, 4)
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 4) = monTab(i, 14)
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 5) = monTab(i, 25)
    If monTab(i, 11) = "N" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 4) = "Pas de Stérilité"
    End If
    If monTab(i, 20) = "N" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 5) = "Pas d'activité"
    End If
    If monTab(i, 11) = "O" Then
    If monTab(i, 15) <> "" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 4) = "Stérilité terminée"
    End If
    If monTab(i, 12) = "" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 4) = "Pas d'infos Stérilité"
    End If
    End If
    If monTab(i, 20) = "O" Then
    If monTab(i, 26) <> "" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 5) = "Activité terminée"
    End If
    If monTab(i, 22) = "" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 5) = "Pas d'infos Activité"
    End If
    End If
    End If
    Next i
    Erase monTab
    'Appro
    DL_RUPTURE = ThisWorkbook.Worksheets("Rupture").Columns("A").Find("", , , , xlByColumns, xlNext).Row
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 1) = "Rupture Appro Marcy"
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 1).Font.Bold = True
    monTab() = ThisWorkbook.Worksheets("Liste Appro Marcy").Range("A3:AK" & DL_APPRO).Value
    For i = LBound(monTab, 1) To UBound(monTab, 1)
    If monTab(i, 29) = "" And (monTab(i, 4) = "Rupture" Or monTab(i, 4) = "Critique") And ((monTab(i, 11) <> "N" And monTab(i, 15) = "" And monTab(i, 14) <= DATE_JOUR) Or (monTab(i, 20) <> "N" And monTab(i, 26) = "" And monTab(i, 25) <= DATE_JOUR)) Then
    DL_RUPTURE = ThisWorkbook.Worksheets("Rupture").Columns("A").Find("", , , , xlByColumns, xlNext).Row
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 1) = monTab(i, 1)
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 2) = monTab(i, 3)
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 3) = monTab(i, 4)
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 4) = monTab(i, 14)
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 5) = monTab(i, 25)
    If monTab(i, 11) = "N" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 4) = "Pas de Stérilité"
    End If
    If monTab(i, 20) = "N" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 5) = "Pas d'activité"
    End If
    If monTab(i, 11) = "O" Then
    If monTab(i, 15) <> "" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 4) = "Stérilité terminée"
    End If
    If monTab(i, 12) = "" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 4) = "Pas d'infos Stérilité"
    End If
    End If
    If monTab(i, 20) = "O" Then
    If monTab(i, 26) <> "" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 5) = "Activité terminée"
    End If
    If monTab(i, 22) = "" Then
    ThisWorkbook.Worksheets("Rupture").Cells(DL_RUPTURE, 5) = "Pas d'infos Activité"
    End If
    End If
    End If
    Next i
    Erase monTab
     
    ' remise des filtres
    If ThisWorkbook.Sheets("Liste T&F").AutoFilterMode = False Then
       ThisWorkbook.Worksheets("Liste T&F").Range("A2:AM2").AutoFilter
    End If
    If ThisWorkbook.Sheets("Liste PETRI").AutoFilterMode = False Then
       ThisWorkbook.Worksheets("Liste PETRI").Range("A2:AC2").AutoFilter
    End If
    If ThisWorkbook.Sheets("Liste Appro Marcy").AutoFilterMode = False Then
       ThisWorkbook.Worksheets("Liste Appro Marcy").Range("A2:AK2").AutoFilter
    End If
    If ThisWorkbook.Sheets("Liste Milieu Sec").AutoFilterMode = False Then
       ThisWorkbook.Worksheets("Liste Milieu Sec").Range("A2:AK2").AutoFilter
    End If
    If ThisWorkbook.Sheets("Rupture").AutoFilterMode = False Then
       ThisWorkbook.Worksheets("Rupture").Range("A1:F1").AutoFilter
    End If
     
     
    ThisWorkbook.Worksheets("Rupture").Activate
    ThisWorkbook.Worksheets("Rupture").Range("A1").Select
     
    End Sub
    et bien la plus de bug ca fonctionne... vas savoir pourquoi....

    en tout cas merci je test et je reviens par ici

    EDIT: MERCI a vous tous lol je vais regarder ceci et faire le test du nothing en effet mais c'est bizarre que il toruve pas de correpondance alors qu'il cherche une cellule vide...
    Merci de cliquer sur pour chaque message vous ayant aidé
    puis sur pour clore cette discussion …

    C'est en récoltant les cailloux qu'on te jette que tu construiras ta future estrade...

  6. #6
    Membre expérimenté
    Homme Profil pro
    Ingénieur développement matériel électronique
    Inscrit en
    Septembre 2013
    Messages
    783
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Ingénieur développement matériel électronique
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Septembre 2013
    Messages : 783
    Points : 1 562
    Points
    1 562
    Par défaut
    Et bien .... c'est de la cohérence tout ça .... quasiment 3 réponses similaires en 4 minutes, c'est-t-y pas beau developpez.com?????
    "Idéalement nous sommes ce que nous pensons. Dans la réalité, nous sommes ce que nous accomplissons." A.Senna
    et n'oubliez-pas de développer des .... sourires ^_^

  7. #7
    Membre émérite Avatar de antonysansh
    Homme Profil pro
    Chargé d'études RH
    Inscrit en
    Mai 2014
    Messages
    1 115
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 32
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Chargé d'études RH
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2014
    Messages : 1 115
    Points : 2 439
    Points
    2 439
    Par défaut
    tlm

    Je me suis fait la même réflexion
    La prochaine fois on s'appel pour se coordonner
    Antony

    Mieux vaut ne rien dire et passer pour un con que de l'ouvrir et ne laisser aucun doute à ce sujet.
    Gustave Parking


    Si le post vous est utile un petit fait toujours plaisir et pensez à passer en

    Et surtout -> Balise CODE

  8. #8
    Membre éclairé
    Homme Profil pro
    autodidacte
    Inscrit en
    Novembre 2013
    Messages
    517
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : autodidacte
    Secteur : Industrie

    Informations forums :
    Inscription : Novembre 2013
    Messages : 517
    Points : 684
    Points
    684
    Par défaut
    Rebonjour à tous,

    C'est donc bien ca, le find renvoie nothing à partir d'un moment. Je ne comrpend pas car il cherche une cellule vide et ne la trouve pas alors qu'il y a que ca mdrr

    j'ai donc changé la méthode pour trouver la dernière ligne

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    DL_RUPTURE = ThisWorkbook.Worksheets("Rupture").Cells(Rows.Count, 1).End(xlUp).Row + 1

    Par contre savez vous qu'est ce qui peut provoquer l'erreur de ne pas trouver de cellule vide? POurquoi renvoyer nothing à partir de la ligne 38? Alors que avant cela fonctionne parfaitement?

    Merci d'avance et merci à tous pour vos réponses de maitre
    Merci de cliquer sur pour chaque message vous ayant aidé
    puis sur pour clore cette discussion …

    C'est en récoltant les cailloux qu'on te jette que tu construiras ta future estrade...

  9. #9
    Membre éclairé
    Homme Profil pro
    autodidacte
    Inscrit en
    Novembre 2013
    Messages
    517
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : autodidacte
    Secteur : Industrie

    Informations forums :
    Inscription : Novembre 2013
    Messages : 517
    Points : 684
    Points
    684
    Par défaut
    PS: vous auriez vraiment intérêt à définir les feuilles que vous appelez dans un tableau .... suggestion,

    WshNAR = ("Liste T&F","Liste PETRI","Liste Appro Marcy")

    Une autre question de passage, je pense bien qu'il est possible de mettre les feuille dans un tableau par contre comment appeler le tableau et dire à excel qu'il faut qu'il passe tout en revue dans le tableau?
    Merci de cliquer sur pour chaque message vous ayant aidé
    puis sur pour clore cette discussion …

    C'est en récoltant les cailloux qu'on te jette que tu construiras ta future estrade...

  10. #10
    Membre expérimenté
    Homme Profil pro
    Ingénieur développement matériel électronique
    Inscrit en
    Septembre 2013
    Messages
    783
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Ingénieur développement matériel électronique
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Septembre 2013
    Messages : 783
    Points : 1 562
    Points
    1 562
    Par défaut
    Bonjour le forum

    Une autre question de passage, je pense bien qu'il est possible de mettre les feuille dans un tableau par contre comment appeler le tableau et dire à excel qu'il faut qu'il passe tout en revue dans le tableau?
    Par exemple (non testé):

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    WshNAR = ("Liste T&F","Liste PETRI","Liste Appro Marcy")
     
    For WshInd = LBound(WshNAR , 1) To UBound(WshNAR , 1)
     
        Set Wsh = ThisWorkbook.Worksheets(WshNAR(WshInd ))
     
    Next WshInd
    "Idéalement nous sommes ce que nous pensons. Dans la réalité, nous sommes ce que nous accomplissons." A.Senna
    et n'oubliez-pas de développer des .... sourires ^_^

  11. #11
    Membre éclairé
    Homme Profil pro
    autodidacte
    Inscrit en
    Novembre 2013
    Messages
    517
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : autodidacte
    Secteur : Industrie

    Informations forums :
    Inscription : Novembre 2013
    Messages : 517
    Points : 684
    Points
    684
    Par défaut
    merci,

    maintenant je vois le principe
    Merci de cliquer sur pour chaque message vous ayant aidé
    puis sur pour clore cette discussion …

    C'est en récoltant les cailloux qu'on te jette que tu construiras ta future estrade...

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. 'Erreur 91 variable objet non défini dans l'exécution d'un userform
    Par Jey14 dans le forum Macros et VBA Excel
    Réponses: 1
    Dernier message: 05/11/2013, 10h23
  2. Renvoi d'erreur Variable Objet non définie
    Par ADbtr dans le forum Macros et VBA Excel
    Réponses: 2
    Dernier message: 05/06/2010, 14h16
  3. Erreur 91 variable objet non définie
    Par kmarcel dans le forum VB 6 et antérieur
    Réponses: 6
    Dernier message: 23/04/2008, 13h17
  4. Erreur 91 variable objet non défini
    Par sebeni dans le forum Général VBA
    Réponses: 3
    Dernier message: 07/05/2007, 11h12
  5. Réponses: 4
    Dernier message: 16/06/2006, 00h27

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