ERREUR D'EXCUTION 5 argument ou appelle de procedure in

Bonjour la communauté, j'aurai besoin de votre petite aide .

Voila grace à GMB que je remercie par l'occasion, je voulais utiliser le code afin de l'adapter à mon cas. Cependant une ERREUR 5 apparait lors de l'envoi de la macro.

L'erreur apparait a RAnge aq4 resize

Option Explicit

Dim tablo, tabloR(), i&, j&, k&, cond1&, cond2&, cond3&, derniereligne&, c As Range

Sub ExtraireTAG()
   Application.ScreenUpdating = False
    tablo = Range("A4:AJ" & Range("A" & Rows.Count).End(xlUp).Row)
    cond1 = Range("AM2")
    cond2 = Range("AN2")
    cond3 = Range("AO2")

    k = 1
    For i = 1 To UBound(tablo, 1)
        If tablo(i, 28) < 0.5 And tablo(i, 33) = cond1 And tablo(i, 36) = cond2 And tablo(i, 34) > cond3 Then
            ReDim Preserve tabloR(1 To 36, 1 To k + 1)
            For j = 1 To 36
                tabloR(j, k) = tablo(i, j)
            Next j
            k = k + 1
        End If
    Next i

    Range("AQ4:BZ6000").Clear
    Range("AQ4").Resize(UBound(tabloR, 2), 36) = Application.Transpose(tabloR)

    For Each c In ActiveSheet.Range("aq4:aq5000")
        c = DateValue(Split(c, "  ")(0)) + TimeValue(Split(c, "  ")(1))
        On Error Resume Next
    Next c
    On Error Resume Next
End Sub

Je joint le fichier en piece jointe en attendant vos réponses merci infiniment.

Bonjour Stéphanie, bonjour le forum,

Visiblement aucune ligne ne remplit les 4 conditions. Donc tabloR est vide et Ubound(tabloR, 2) génère une erreur. Vérifie les 4 conditions...

merci pour ta reponse, en effet cela ne remplie pas la condition c'est pour cela que l'utilisateur informe dans la cellule la condition qu'il veut afin de copier les resultats.Dans ce cas la mon code n'est valable que pour une condition specifique je ne peux pas changer de condition meme si mon tableau ne contient aucune condition que je lui es informé sur mes cellule ??

Merci beaucoup si quelquun pourrait m'aider avec plaisir !!!

Re,

Essai comme ça :

Option Explicit

Dim tablo, tabloR(), i&, j&, k&, cond1&, cond2&, cond3&, derniereligne&, c As Range

Sub ExtraireTAG()
Application.ScreenUpdating = False
tablo = Range("A4:AJ" & Range("A" & Rows.Count).End(xlUp).Row)
cond1 = Range("AM2")
cond2 = Range("AN2")
cond3 = Range("AO2")

k = 1
For i = 1 To UBound(tablo, 1)
    If tablo(i, 28) < 0.5 And tablo(i, 33) = cond1 And tablo(i, 36) = cond2 And tablo(i, 34) > cond3 Then
        ReDim Preserve tabloR(1 To 36, 1 To k)
        For j = 1 To 36
            tabloR(j, k) = tablo(i, j)
        Next j
        k = k + 1
    End If
Next i
Range("AQ4:BZ6000").Clear
If k > 1 Then
    Range("AQ4").Resize(UBound(tabloR, 2), 36) = Application.Transpose(tabloR)
    On Error Resume Next
    For Each c In ActiveSheet.Range("aq4:aq5000")
        c = DateValue(Split(c, "  ")(0)) + TimeValue(Split(c, "  ")(1))
    Next c
End If
End Sub

La condition Si k > 1 évite le bug si tabloR est vide...

Merci beaucoup effectivement cela marche !!!!

Rechercher des sujets similaires à "erreur excution argument appelle procedure"