[VBA-E]Excel: RechercheV avec erreur dans visual basic
J'essai de créer une macro qui recherche une information qui varie. Cette information rechercher peut ne pas exister. Dans une feuille excel on peut inscrire avec la fonction si(esterreur(....)) mais dans vb comment peut-on arriver à faire une rechercheV sans erreur??
voici les codes que j'ai essayer:
********
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| For Valeur = 1 To 48
Dim a, donnee
a = ActiveCell.Offset(-6, 0).Range("a1")
donnee = (if(ISERROR(Application.WorksheetFunction.VLookup(a, Worksheets("UA JANVIER").Range("A1:F20000"), 6, False);"";Application.WorksheetFunction.VLookup(a, Worksheets("UA JANVIER").Range("A1:F20000"), 6, False)))
ActiveCell.Value = donnee
ActiveCell.Offset(0, 1).Range("A1").Select
*********
' donnee = IIf(IsError(Application.WorksheetFunction.VLookup(a, Worksheets("UA JANVIER").Range("A1:F20000"), 6, False)), "E", Application.WorksheetFunction.VLookup(a, Worksheets("UA JANVIER").Range("A1:F20000"), 6, False))
**********
If Application.WorksheetFunction.VLookup(a, Worksheets("UA JANVIER").Range("A1:F20000"), 6, False) = Error Then
ActiveCell = "0"
Else
ActiveCell = Application.WorksheetFunction.VLookup(a, Worksheets("UA JANVIER").Range("A1:F20000"), 6, False)
End If |
**********
J'attend avec impatience vos commentaires. Merci à l'avance!