Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1482 connectés 

  FORUM HardWare.fr
  Windows & Software
  Logiciels

  Tableur Exel , quel est la fonction pour passer de chiffre en lettre?

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Tableur Exel , quel est la fonction pour passer de chiffre en lettre?

n°2791759
dekcah
Posté le 10-07-2008 à 11:22:07  profilanswer
 

Bonjour ,
 
 je m'explique...
 
par exemple la fonction qui transforme  "401" en "quatre cent un" ..?
 
Merci, biz

mood
Publicité
Posté le 10-07-2008 à 11:22:07  profilanswer
 

n°2791781
thev
Posté le 10-07-2008 à 13:08:29  profilanswer
 

Quand j'ai cherché, je n'ai pas trouvé. J'en ai donc écrit une qui fonctionne bien pour tout montant < 1 million.
Si ça t'intéresse, je peux te la faire parvenir.

n°2791803
dekcah
Posté le 10-07-2008 à 14:20:54  profilanswer
 

Oui ca m'interesserai... S.T.P

n°2791820
thev
Posté le 10-07-2008 à 15:14:16  profilanswer
 

Je t'ai envoyé le code via message privé. Donc enregistrer la fonction en .xla et la stocker dans le répertoire des macros complémentaires.

n°2791952
dekcah
Posté le 11-07-2008 à 07:15:57  profilanswer
 

Merci, ca a l'air de marcher mais je vois pas comment la mettre dans exel...
 
J'ai réussi a bidouiller dans les macros, je me retrouve sur Visula Basic, ca marche sur le classeur, apres je reessaye et ca ne marche plus ...
 
Fin je sais pas trop comment l'enregistrer etc..
 
j'ai copié sur le notepad et enregistré en .xla ... mais bon aprés...
 
Merci

n°2791974
thev
Posté le 11-07-2008 à 10:31:52  profilanswer
 

1) ouvrir Excel--> nouveau classeur
2) menu Macro--> Visual Basic Editor
3) fenêtre Visual Basic Editor --> menu Insertion--> module --> copie du code dans la fenêtre
4) fenêtre Excel --> menu Fichier --> Enregistrer sous --> type de fichier (*.xla) , nom = chiflettre
4) fermer fenêtres Excel et Visual basic
 
Vérifier si la macro est bien activée:
1) ouvrir Excel --> nouveau classeur
2) menu Outil --> macros complémentaires : la macro doit apparaître et est être cochée.    
 
 

n°2791980
dekcah
Posté le 11-07-2008 à 10:52:33  profilanswer
 

MErci tout plein !!!!!

n°2791986
SuppotDeSa​Tante
Aka dje69r
Posté le 11-07-2008 à 11:03:52  profilanswer
 

Bonjour
 

thev a écrit :

Je t'ai envoyé le code via message privé. Donc enregistrer la fonction en .xla et la stocker dans le répertoire des macros complémentaires.


 
Quel dommage que la fonction n'apparait pas ici, ca pourrait servir pour d'autres personnes...
 
Cordialement


---------------
Soyez malin, louez entre voisins !
n°2792006
thev
Posté le 11-07-2008 à 11:49:36  profilanswer
 

Je n'avais pas mis le code pour ne pas encombrer le sujet.
Donc, voici mon code. Je n'ai pas traité le montant >=  un million mais on peut l'ajouter si nécessaire.
 
Function ChifLettre(montant)
 
' Constantes
 
Unité = Array("", "UN", "DEUX", "TROIS", "QUATRE", "CINQ", "SIX", "SEPT", "HUIT", "NEUF" )
Dizunité = Array("", "ONZE", "DOUZE", "TREIZE", "QUATORZE", "QUINZE", "SEIZE" )
dizaine = Array("", "DIX", "VINGT", "TRENTE", "QUARANTE", "CINQUANTE", "SOIXANTE", "SOIXANTE DIX", "QUATRE VINGT", "QUATRE VINGT DIX" )
 
 
' ************************************
 
If IsNumeric(montant) = False Then
    L = "valeur non numérique"
    GoTo fin
End If
chif_euros = Abs(Fix(montant))
 
' recherche centaine millier "
 
qcm = chif_euros \ 100000
rcm = chif_euros Mod 100000
If qcm > 9 Then
    L = "montant non pris en charge"
    GoTo fin
End If
 
 
If qcm > 1 Then
    L = Unité(qcm) & " "
End If
If qcm > 0 Then
     L = L & "CENT" & " "
End If
 
' recherche millier "
 
qm = rcm \ 1000
rm = rcm Mod 1000
 
If qm = 1 And L <> Empty _
Or qm > 1 Then
    qd = qm \ 10
    rd = qm Mod 10
    GoSub dizaine
    L = L & D
End If
If qcm > 0 Or qm > 0 Then
    L = L & "MILLE" & " "
End If
 
' recherche centaine "
 
qc = rm \ 100
rc = rm Mod 100
 
If qc > 1 Then
   L = L & Unité(qc) & " "
End If
If qc > 0 Then
    L = L & "CENT" & " "
End If
 
 
' recherche dizaine "
 
qd = rc \ 10
rd = rc Mod 10
 
GoSub dizaine
L = L & D
If chif_euros > 1 Then
    L = L & "EUROS" & " "
End If
If chif_euros = 1 Then
    L = L & "EURO" & " "
End If
 
' recherche centimes "
Dim chif_millième As Integer
Dim quotient As Integer
Dim reste As Integer
chif_millième = Int((Abs(montant) - chif_euros) * 1000)
quotient = chif_millième \ 10
reste = chif_millième Mod 10
If reste < 5 Then
    chif_centimes = quotient
Else
    chif_centimes = quotient + 1
End If
qd = chif_centimes \ 10
rd = chif_centimes Mod 10
GoSub dizaine
If Int(chif_centimes) > 1 Then
    Lc = "ET " & D & "CENTIMES"
End If
If Int(chif_centimes) = 1 Then
    Lc = "ET " & D & "CENTIME"
End If
 
 
' fin fonction
 
GoTo fin
 
' ***************** fonction dizaine *******************
 
dizaine:
 
lien = ""
If qd = 0 Then
   i3 = rd
   i2 = 0
   i1 = 0
End If
 
If qd = 1 Then
    If rd > 0 And rd < 7 Then
        i3 = 0
        i2 = rd
        i1 = 0
    Else
        i3 = rd
        i2 = 0
        i1 = qd
        If rd > 0 Then
           lien = " "
        End If
    End If
End If
 
If qd > 1 And qd < 7 Or qd = 8 Then
   i3 = rd
   i2 = 0
   i1 = qd
   If rd = 1 And qd <> 8 Then
      lien = " ET "
   Else
      lien = " "
   End If
End If
 
If qd = 7 Or qd = 9 Then
    lien = " "
    If rd > 0 And rd < 7 Then
        i3 = 0
        i2 = rd
        i1 = qd - 1
    Else
        i3 = rd
        i2 = 0
        i1 = qd
    End If
End If
 
D = dizaine(i1) & lien & Dizunité(i2) & Unité(i3) & " "
 
Return
 
' ***************** fin routine dizaine *******************
   
fin:
ChifLettre = L & Lc
 
End Function


Message édité par thev le 11-07-2008 à 11:54:36

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Windows & Software
  Logiciels

  Tableur Exel , quel est la fonction pour passer de chiffre en lettre?

 

Sujets relatifs
[Tableur] Aide pour la réalisation d'une factureCasse tête sur exel sur automatisation de tâches
passer d'outlook 2000 a outlook 2007Passer de vista vers XP
Passer de Vista 32 Bits à Vista 64 Bits[Excel/OOo] extraire d'une liste en fonction d'une autre liste
Menu contextuel de l'explorateur - Ajouter fonction "Listing" fichiersAutoriser certains programes a passer l'autorisation UAC ?
Raccourci pour passer d'un affichage a un autre 
Plus de sujets relatifs à : Tableur Exel , quel est la fonction pour passer de chiffre en lettre?


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR