Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

transformer du txt en numérique suite

7 réponses
Avatar
A QUEMENER
Bonjour,

Merci à Philippe.R pour ta réponse mais je souhaite règler le problème par
macro.

J'ai trouvé ce code chez http://dj.joss.free.fr/cell2.htm

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Plage As Range
Set Plage = Intersect(Target, Range("A1:A10"))
If Plage Is Nothing Then Exit Sub
For Each cellule In Plage
If cellule.Value = 1 Then
cellule.NumberFormat = "General"" er"""
Else: cellule.NumberFormat = "General"" ème"""
End If
Next
end sub

Je voudrais l'utiliser dans un module mais je ne sais pas inscrire (ByVal
Target As Range) dans le module.

Qqu'un peut-il m'aider ?
Merci
cordialement
andré

7 réponses

Avatar
Philippe.R
Bonjour,
Comme ceci peut être :

Sub textenum()
'MPFE le 27/02/2005
For Each cellule In Selection
If cellule <> "" Then cellule.Value = cellule.Value + 0
If cellule.Value = 1 Then
cellule.NumberFormat = "General"" er"""
Else
cellule.NumberFormat = "General"" ème"""
End If
Next
End Sub

--
Amicales Salutations
XL 97 / 2000 / 2002
Préférez suivre facilement sur le forum :
news://msnews.microsoft.com/microsoft.public.fr.excel
(Voulez-vous vous abonner ? -> Oui)

"A QUEMENER" a écrit dans le message de news:
cvs748$h7$
Bonjour,

Merci à Philippe.R pour ta réponse mais je souhaite règler le problème par macro.

J'ai trouvé ce code chez http://dj.joss.free.fr/cell2.htm

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Plage As Range
Set Plage = Intersect(Target, Range("A1:A10"))
If Plage Is Nothing Then Exit Sub
For Each cellule In Plage
If cellule.Value = 1 Then
cellule.NumberFormat = "General"" er"""
Else: cellule.NumberFormat = "General"" ème"""
End If
Next
end sub

Je voudrais l'utiliser dans un module mais je ne sais pas inscrire (ByVal Target As Range) dans le
module.

Qqu'un peut-il m'aider ?
Merci
cordialement
andré




Avatar
AV
Je vois pas l'intérêt d'une macro...!
Un format personnalisé (si je comprends bien la demande) fait très bien
l'affaire :

[=1]"1er";[>1]#"ème";"-"

AV
Avatar
A QUEMENER
MERCI PHILIPPE
C'est super c'est exactement ce que je souhais.
très sincérement MERCI
andré
"Philippe.R" a écrit dans le message de news:

Bonjour,
Comme ceci peut être :

Sub textenum()
'MPFE le 27/02/2005
For Each cellule In Selection
If cellule <> "" Then cellule.Value = cellule.Value + 0
If cellule.Value = 1 Then
cellule.NumberFormat = "General"" er"""
Else
cellule.NumberFormat = "General"" ème"""
End If
Next
End Sub

--
Amicales Salutations
XL 97 / 2000 / 2002
Préférez suivre facilement sur le forum :
news://msnews.microsoft.com/microsoft.public.fr.excel
(Voulez-vous vous abonner ? -> Oui)

"A QUEMENER" a écrit dans le message de news:
cvs748$h7$
Bonjour,

Merci à Philippe.R pour ta réponse mais je souhaite règler le problème
par macro.

J'ai trouvé ce code chez http://dj.joss.free.fr/cell2.htm

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Plage As Range
Set Plage = Intersect(Target, Range("A1:A10"))
If Plage Is Nothing Then Exit Sub
For Each cellule In Plage
If cellule.Value = 1 Then
cellule.NumberFormat = "General"" er"""
Else: cellule.NumberFormat = "General"" ème"""
End If
Next
end sub

Je voudrais l'utiliser dans un module mais je ne sais pas inscrire (ByVal
Target As Range) dans le module.

Qqu'un peut-il m'aider ?
Merci
cordialement
andré







Avatar
AV
Et tu penses quoi de ma remarque ?
(si c'est pas trop te déranger)

AV
Avatar
GD
Bonsour® AV ;o)))
Et tu penses quoi de ma remarque ?
(si c'est pas trop te déranger)


le môsieur André souhaite règler le problème par macro.

Sub textenum()
'MPFE le 27/02/2005
' ------ Rauphil et AV ;o)))
For Each cellule In Selection
Cellule.NumberFormat "[=1]""1er"";[>1]#""ème"";[Red]General;[Cyan]@"
Next
End Sub

;o)))
@+

Avatar
Philippe.R
;o)))))))))
--
Amicales Salutations

"GD" a écrit dans le message de news: %
Bonsour® AV ;o)))
Et tu penses quoi de ma remarque ?
(si c'est pas trop te déranger)


le môsieur André souhaite règler le problème par macro.

Sub textenum()
'MPFE le 27/02/2005
' ------ Rauphil et AV ;o)))
For Each cellule In Selection
Cellule.NumberFormat > "[=1]""1er"";[>1]#""ème"";[Red]General;[Cyan]@"
Next
End Sub

;o)))
@+





Avatar
AV
le môsieur André souhaite règler le problème par macro.


Pfff.....
Faudrait quand même qu'il songe à s'ouvrir qques horizons....

AV