Bonjour,
Le problème vient du SI() qui visiblement génère une erreur quand je veux envoyer son résultat dans la fonction, donc j'ai contourné le problème:
Je n'utilise plus le SI(), à la place j'ai mis un paramètre où on vient indiquer si on prend le texte ou non, j'ai simplement mis comme test: la personne correspond.
Le fichier:
Une formule:
=f_joindreTexte(" / ";B$2:B$9;$A$2:$A$9=$A11)
Le code:
Function f_joindreTexte(ByVal delimiteur As String, texte, jointTexte) As String
Dim resultat As String
Dim tableau As Variant
tableau = texte
Application.Volatile
For i = 1 To UBound(tableau, 1)
If jointTexte(i, 1) Then
If Not resultat = "" Then
resultat = resultat & delimiteur & tableau(i, 1)
Else
resultat = tableau(i, 1)
End If
End If
Next i
f_joindreTexte = resultat
End Function