Option Explicit
Sub test()
Debug.Print Nblettre2020(380)
Debug.Print Nblettre2020(100)
Debug.Print Nblettre2020(1000)
Debug.Print Nblettre2020(1000000000#)
Debug.Print Nblettre2020(10020000000#)
Debug.Print Nblettre2020(1000000)
Debug.Print Nblettre2020(31000)
Debug.Print Nblettre2020(0)
Debug.Print Nblettre2020(371)
Debug.Print Nblettre2020("191471851,56")
Debug.Print Nblettre2020(191471851.56)
Debug.Print Nblettre2020("135761973946357916972394685379,56")
End Sub
Function Nblettre2020(chain)
Dim t, dixx&, dix&, cxx&, u&, Part, ms, m, Ul, Diz, n&, I&, seg$, cc$, et$, Ss$, R$, md$, chaine$
Ul = Array("", "un", "deux", "trois", "quatre", "cinq", "six", "sept", "huit", "neuf", "dix", "onze", "douze", "treize", "quatorze", "quinze", "seize", "dix-sept", "dix-huit", "dix-neuf", "cent ")
Diz = Array("", "dix", "vingt", "trente", "quarante", "cinquante", "soixante", "soixante-dix", "quatre-vingt", "quatre-vingt-dix", "cent")
ms = Array("", " septilliard", " sextilliard", " Quintrillion", " quadrilliard", " trilliard", " Billiard", " milliard", " million", " mille", "")
Part = Split(chain, ",")
For n = LBound(Part) To UBound(Part)
chaine = Part(n)
t = Split(Trim(Format(String((300 - Len(Part(n))) Mod 3, "0") & Part(n), WorksheetFunction.Rept(" @@@", Len(String((300 - Len(Part(n))) Mod 3, "0") & Part(n)) / 3))))
m = UBound(ms) - UBound(t)
For I = LBound(t) To UBound(t)
seg = t(I)
cxx = Left(seg, 1): dixx = Right(seg, 2): dix = Mid(seg, 2, 1): u = Right(seg, 1)
If cxx = 1 Then cxx = 20: cc = "" Else cc = IIf(cxx > 0, " cent ", "")
If dix = 9 Or dix = 7 Then dix = dix - 1: u = Val(u) + 10
If dixx > 9 And dixx < 20 Then dix = 0: u = u + 10
If dix >= 2 And dix <= 7 And (u = 1 Or u = 11) Then et = " et " Else et = IIf(dix <> 0 And u <> 0, "-", " ")
If dixx = 80 Then Ss = "s" Else Ss = ""
If I = UBound(t) - 1 And Part(0) = 1000 Then u = 0
md = ms(m): If Val(seg) > 1 And I < UBound(t) Then md = md & "s"
R = R & Application.Trim(Ul(cxx) & cc & Diz(dix) & et & Ul(u)) & Ss & IIf(Val(seg) > 0, md, "") & " "
m = m + 1
Next
R = R & IIf(UBound(Part) > 0 And n = 0, "virgule ", "")
If Trim(R) = "" Then R = "zero"
Next n
Nblettre2020 = chain & "--> " & Trim(R)
End Function