On Error GoTo non fonctionnel
A
Texte = Sheets("Sortie").Cells(3, B + 1).Value & " " & Sheets("Sortie").Cells(3, B).Value & " " & Sheets("Sortie").Cells(1, B).Value '& " " & Sheets("Sortie").Cells(2, B + 1).Value / 1000
On Error GoTo NIVERR0
Cells(2, B + 1) = Application.WorksheetFunction.VLookup(Texte, Sheets("Connexion").Range("A2:L1660"), 9, False) * 1000
GoTo CONTINUERBonjour à tous,
J'ai créer un code pour trouver un texte dans un tableau avec la fonction VLookup. Ce code à l'air d'être bon mais c'est au niveau du On error que je coince.
En effet le On error est situé dans une boucle For et fonctionne une première fois mais pour le deuxième je reçois une erreur que voici.
Merci pour votre aide,
Bonne journée,
Arthur
Invité
Bonjour Arthur
On Error Resume NExtMais le mieux est de mettre le résultat dans une variable objet et de tester celle-ci
Dim CelF as Range
Texte = Sheets("Sortie").Cells(3, B + 1).Value & " " & Sheets("Sortie").Cells(3, B).Value & " " & Sheets("Sortie").Cells(1, B).Value '& " " & Sheets("Sortie").Cells(2, B + 1).Value / 1000
On Error Resume Next
Set CelF = Application.WorksheetFunction.VLookup(Texte, Sheets("Connexion").Range("A2:L1660"), 9, False)
If Not CelF Is Nothing then Cells(2, B + 1) = CelF.value * 1000
On Error Goto 0A+
A
Invité
Re,
Oups, comme tu utilise une fonction, il faut garder le "On Error" effectivement
Dim CelF as Range
Texte = Sheets("Sortie").Cells(3, B + 1).Value & " " & Sheets("Sortie").Cells(3, B).Value & " " & Sheets("Sortie").Cells(1, B).Value '& " " & Sheets("Sortie").Cells(2, B + 1).Value / 1000
On Error Resume Next
Set CelF = Application.WorksheetFunction.VLookup(Texte, Sheets("Connexion").Range("A2:L5000"), 9, False)
If Not CelF Is Nothing then Cells(2, B + 1) = CelF.value * 1000
Set CelF = Nothing
On Error Goto 0Attention à la ligne de fin de la colonne "L" que j'ai mis à 5.000 (à voir)
A+
