Salut,
Ouvres ton fichier, clic droit sur l'onglet de page, cela va t'ouvrir le visual basic
Insertion/Module dans cette page blanche colles la totalité du code ci-dessous
Function chiffrelettre(s)
Dim a As Variant, gros As Variant
a = Array("", "Un", "Deux", "Trois", "Quatre", "Cinq", "Six", "Sept", _
"Huit", "Neuf", "Dix", "Onze", "Douze", "Treize", "Quatorze", "Quinze", "Seize", "Dix Sept", _
"Dix Huit", "Dix Neuf", "Vingts", "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"
Cent = 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
'billions au centaines
gp = 1
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 = "Cents " & 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(Cent)
If t <> "" Then myct = IIf(Cent = 1, " Cent ", " Cents ")
If t = "" Then myct = IIf(Cent = 1, " Cent d'Euro ", " Cents d'Euro ")
If Cent = 0 Then d = "": myct = ""
chiffrelettre = t & d & myct
End Function
Reviens sur ta feuille de cacul et sélectionnes la cellule qui doit contenir le montant en lettre
Insertion/Fonction, sélectionnes Personnalisée et clic sur chiffrelettre
Une boite de dialogue va s'ouvrir, clic sur la cellule dans laquelle tu saisieras la valeur en chiffre
Si tu rencontre un problème reviens sur le forum, de toute façon tiens nous au courant
A+
Mike-31
Un problème sans solution est un problème mal posé (Einstein)