Option Explicit
Function Cpte(Txt As String) As Variant
Application.Volatile
Dim Dic As Object, i As Integer, Nbt As String, Clef
Set Dic = CreateObject("Scripting.Dictionary")
Dic.RemoveAll
For i = 1 To Len(Txt)
If Mid(Txt, i, 1) Like "#" Then
Nbt = Nbt & Mid(Txt, i, 1)
Else
Dic(Mid(Txt, i, 1)) = Dic(Mid(Txt, i, 1)) + CInt(Nbt)
Nbt = ""
End If
Next
ReDim TbRes(1 To 1, 1 To Dic.Count)
i = 0
For Each Clef In Dic.keys
i = i + 1
TbRes(1, i) = Dic(Clef) & Clef
Next
Cpte = TbRes
End Function