1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
Function CONCATENERMEF(p As Range) As String
Dim NbCar As Integer
Dim i As Integer, j As Integer
Dim FormatF() As Variant ' Tableau pour stocker les paramètres de mise en forme
' Initialiser la chaîne de texte concaténée
Concat = ""
i = 0
'On redimensionne la table en fonction du nombre de cellule
ReDim FormatF(1 To p.Cells.Count, 1 To 7) ' 7 paramètres de mise en forme
'Boucler sur chaque cellule de la plage
For Each c In p
' la chaîne concaténée
Concat = Concat & c.Text
' Copier les paramètres de mise en forme du caractère actuel dans le tableau
i = i + 1
FormatF(i, 7) = Len(c.Text)
FormatF(i, 1) = c.Font.Name
FormatF(i, 2) = c.Font.Size
FormatF(i, 3) = c.Font.Color
FormatF(i, 4) = c.Font.Bold
FormatF(i, 5) = c.Font.Italic
FormatF(i, 6) = c.Font.Underline
Next c
For j = 1 To i
Debug.Print FormatF(i, 1)
Debug.Print FormatF(i, 2)
Debug.Print FormatF(i, 3)
Debug.Print FormatF(i, 4)
Debug.Print FormatF(i, 5)
Debug.Print FormatF(i, 6)
Debug.Print FormatF(i, 7)
Next j
' Retourner le résultat
CONCATENERMEF = Concat
End Function |
Partager