Function chiffrelettre(s) 'Trouvé sur ExceLabo
Dim A As Variant, gros As Variant ' étant fait par excelabo,
Dim Sp As Variant, Chaine$ 'ça m'évite de devoir cogiter pour le faire
Dim centime As Double
A = Array("", "un", "deux", "trois", "quatre", "cinq", "six", "sept", _
huit, "neuf", "dix", "onze", "douze", "treize", "quatorze", "quinze", "seize", "dix sept", _
dix huit, "dix neuf", "vingt", "vingt et un", "vingt deux", "vingt trois", "vingt quatre", _
vingt cinq, "vingt six", "vingt sept", "vingt huit", "vingt neuf", "trente", "trente et un", _
trente deux, "trente trois", "trente quatre", "trente cinq", "trente six", "trente sept", _
trente huit, "trente neuf", "quarante", "quarante et un", "quarante deux", "quarante trois", _
quarante quatre, "quarante cinq", "quarante six", "quarante sept", "quarante huit", _
quarante neuf, "cinquante", "cinquante et un", "cinquante deux", "cinquante trois", _
cinquante quatre, "cinquante cinq", "cinquante six", "cinquante sept", "cinquante huit", _
cinquante neuf, "soixante", "soixante et un", "soixante deux", "soixante trois", _
soixante quatre, "soixante cinq", "soixante six", "soixante sept", "soixante huit", _
soixante neuf, "soixante dix", "soixante et onze", "soixante douze", "soixante treize", _
soixante quatorze, "soixante quinze", "soixante seize", "soixante dix sept", _
soixante dix huit, "soixante dix neuf", "quatre-vingts", "quatre-vingt un", _
quatre-vingt deux, "quatre-vingt trois", "quatre-vingt quatre", "quatre-vingt cinq", _
quatre-vingt six, "quatre-vingt sept", "quatre-vingt huit", "quatre-vingt neuf", _
quatre-vingt dix, "quatre-vingt onze", "quatre-vingt douze", "quatre-vingt treize", _
quatre-vingt quatorze, "quatre-vingt quinze", "quatre-vingt seize", "quatre-vingt dix sept", _
quatre-vingt dix huit, "quatre-vingt dix neuf")
gros = Array("", "billions", "milliards", "millions", "mille", "EUROS", "billion", _
milliard, "million", "mille", "EURO")
Sp = Space(1)
Chaine = "00000000000000"
centime = s * 100 - (Int(s) * 100)
s = Str(Int(s)): Lg = Len(s) - 1: s = Right(s, Lg): Lg = Len(s)
If Lg < 15 Then Chaine = Mid(Chaine, 1, (15 - Lg)) Else Chaine = ""
s = Chaine + s
Gp = 1 'billions au centaines
For K = 1 To 5
X = Mid(s, Gp, 1): c = A(Val(X))
X = Mid(s, Gp + 1, 2): D = A(Val(X))
If K = 5 Then
If t2 <> "" And c & D = "" Then mydz = "Euros" & Sp: GoTo fin
If T <> "" And c = "" And D = "un" Then mydz = "un euros" & Sp: GoTo fin
If T <> "" And t2 = "" And c & D = "" Then mydz = "d'Euros" & Sp: GoTo fin
If T & c & D = "" Then myct = "": mydz = "": GoTo fin
End If
If c & D = "" Then GoTo fin
If D = "" And c <> "" And c <> "un" Then mydz = c & Sp & "cents " & gros(K) & Sp: GoTo fin
If D = "" And c = "un" Then mydz = "cent " & gros(K) & Sp: GoTo fin
If D = "un" And c = "" Then myct = IIf(K = 4, gros(K) & Sp, "un " & gros(K + 5) & Sp): GoTo fin
If D <> "" And c = "un" Then mydz = "cent" & Sp
If D <> "" And c <> "" And c <> "un" Then mydz = c & Sp & "cent" + Sp
myct = D & Sp & gros(K) & Sp
fin:
t2 = mydz & myct
T = T & mydz & myct
mydz = "": myct = ""
Gp = Gp + 3
Next
D = A(centime)
If T <> "" Then myct = IIf(centime = 1, " centime", " centimes")
If T = "" Then myct = IIf(centime = 1, " centime d'Euro", " centimes d'Euro")
If centime = 0 Then D = "": myct = ""
chiffrelettre = T & D & myct
End Function