Total automatique exel 2019 Nombre en lettre.
RésoluDJAMALOS Messages postés 332 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
Cherche fonction nombre en lettre VBA excel 2019
total automatique : exemple : 1 889 912, 68 DA
Un Million Huit Cent Quatre Vingt Neuf Mille Neuf Cent Douze et 68 Centimes.
Au debut de chaque lettre en Majuscule.
Merci.
Windows / Edge 120.0.0.0
- Total automatique exel 2019 Nombre en lettre.
- Telecharger office 2019 - Télécharger - Traitement de texte
- Réponse automatique thunderbird - Guide
- Telecharger macro convertir chiffre en lettre excel - Télécharger - Tableur
- Clavier iphone chiffre et lettre - Guide
- Logiciel de sauvegarde automatique gratuit - Guide
2 réponses
Essaie ça
Function NombreEnLettres(ByVal Montant As Double) As String
Dim Unités As Variant, Dizaines As Variant, Centaines As Variant
Dim T As String, R As String
Dim Num As String, DecimalPart As String
Unités = Array("", "Un", "Deux", "Trois", "Quatre", "Cinq", "Six", "Sept", "Huit", "Neuf")
Dizaines = Array("", "Dix", "Vingt", "Trente", "Quarante", "Cinquante", "Soixante", "Soixante", "Quatre-Vingt", "Quatre-Vingt")
Centaines = Array("", "Cent", "Deux Cent", "Trois Cent", "Quatre Cent", "Cinq Cent", "Six Cent", "Sept Cent", "Huit Cent", "Neuf Cent")
Num = Format(Abs(Montant), "###0.00")
DecimalPart = Right(Num, 2)
If Len(Num) > 6 Then
R = Unités(Int(Left(Num, Len(Num) - 6))) & " Million "
Num = Right(Num, 6)
End If
If Len(Num) > 3 Then
R = R & Centaines(Int(Left(Num, Len(Num) - 3))) & " "
Num = Right(Num, 3)
End If
If Len(Num) > 2 Then
T = Dizaines(Int(Left(Num, 1)))
Num = Right(Num, 2)
If T = "Dix" Then
T = T & " " & Unités(Int(Num))
ElseIf T = "Vingt" And Left(Num, 1) = "1" Then
T = T & "-" & "Et-" & Unités(Right(Num, 1))
ElseIf T = "Quatre-Vingt" And Left(Num, 1) = "1" Then
T = T & "-" & "Et-" & Unités(Right(Num, 1))
ElseIf T <> "" Then
T = T & "-"
End If
R = R & T
End If
If Len(R) > 0 And Right(R, 1) <> "-" Then R = R & " "
If Len(Num) > 0 Then
R = R & Unités(Int(Num))
End If
If DecimalPart <> "00" Then
R = R & " et " & DecimalPart & " Centimes"
End If
NombreEnLettres = StrConv(Left(R, 1), vbUpperCase) & Mid(R, 2)
End Function
insére-la dans un module VBA d'Excel. Ensuite, dans une cellule Excel, tu peux utiliser la formule =NombreEnLettres(A1)