bonjour j'ai réaliser une fonction de recherche mais je n'arrive pas a trouvé mon erreur au lieu de me renvoyer un resultat en fonction d'un nom il me renvoi toute la colonne voici le fichier si quelqu'un peut m'aider merci
Function findplan(numdossier As Range) As String
Application.Volatile ' rend la mise a jour de la fonction continue
Code:
Dim DerLig As Long, Lig As Long, VPlan As String
findplan = ""
With Sheets("client")
DerLig = .Range("B" & Rows.Count).End(xlUp).Row
For Lig = 2 To DerLig
' Vérifier si le devis du plan correspond à la recherche
If [COLOR="Red"][B].Cells(Lig, 1).Value [/B][/COLOR]= numdossier Then
VPlan = .Range("b" & Lig).Value
findplan = findplan & VPlan & " "
End If
Next Lig
End With
End Function
persoonellement, un rechercheV fait la meme chose et est beaucoup plus rapide
Function findplan(numdossier As Range) As String
Application.Volatile ' rend la mise a jour de la fonction continue
Code:
Dim DerLig As Long, Lig As Long, VPlan As String
findplan = ""
With Sheets("client")
DerLig = .Range("B" & Rows.Count).End(xlUp).Row
For Lig = 2 To DerLig
' Vérifier si le devis du plan correspond à la recherche
If [COLOR="Red"][B].Cells(Lig, 1).Value [/B][/COLOR]= numdossier Then
VPlan = .Range("b" & Lig).Value
findplan = findplan & VPlan & " "
End If
Next Lig
End With
End Function
persoonellement, un rechercheV fait la meme chose et est beaucoup plus rapide