'********************************************
'fonction JOINDRE_TEXTE pour les versions EXCEL inferieur à 2016
'patricktoulon
' version 1.0
'utilisation en formule:
'=JOINDRE_TEXTE2007(A1:A3;"-")' join plusieurs cellule contigues de la meme colonne
'=JOINDRE_TEXTE2007(A1:C1;"-")' join plusieurs cellule contigues de la meme ligne
'*******************************************
Function JOINDRE_TEXTE2007(r As Range, Char As String)
Dim Tbl, T$
If r.Rows.Count = 1 Then Tbl = Application.Index(r.Value, 1, 0) Else Tbl = Application.Transpose(r)
T = Join(Tbl, "|"): T = Replace(T, " ", "*"): T = Application.Trim(Replace(T, "|", " "))
JOINDRE_TEXTE2007 = Replace(Replace(T, " ", Char), "*", " ")
End Function
Sub test5()
MsgBox JOINDRE_TEXTE2007([A1:A8], "-")
MsgBox JOINDRE_TEXTE2007([A1:h1], "-")
End Sub