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

Au secours !

1 réponse
Avatar
Calou
Bonjour,

Voilà, j'ai une fonction à modifier et je comprend pas pourquoi il me met
une erreur de syntaxe au niveau de la ligne qui commencent par *


Function ModFormat(Rg As Range)
Dim chaine As String
Dim An, Mois, Jour As Integer
If Rg = 0 Then
chaine = "--"
Else
'Année
An = Int(Rg / 360)
If An > 0 Then
If An > 1 Then
chaine = An & " Ans "
Else
chaine = An & " An "
End If
End If
'Mois
Mois = Int(Int(Rg - (An * 360)) / 30)
chaine = chaine & Mois & " Mois "
'Jours
Jour = (Rg - (An * 360) - (Mois * 30))
If Jour > 0 Then
* chaine = chaine&jour
If Jour = 1 Then
chaine=chaine&" Jour"
Else
chaine=chaine&" Jours"
End If
End If
End If
ModFormat = chaine
End Function


Veuillez me pardonner pour mon ignorance et un grand merci pour vos
conseils.

Bonne journée

1 réponse

Avatar
Francois L
Bonjour,

Attention aux espaces autour du & de concaténation :

If Jour > 0 Then
chaine = chaine & Jour
If Jour = 1 Then
chaine = chaine & " Jour"
Else
chaine = chaine & " Jours"
End If
End If


--
François L



Bonjour,

Voilà, j'ai une fonction à modifier et je comprend pas pourquoi il me met
une erreur de syntaxe au niveau de la ligne qui commencent par *


Function ModFormat(Rg As Range)
Dim chaine As String
Dim An, Mois, Jour As Integer
If Rg = 0 Then
chaine = "--"
Else
'Année
An = Int(Rg / 360)
If An > 0 Then
If An > 1 Then
chaine = An & " Ans "
Else
chaine = An & " An "
End If
End If
'Mois
Mois = Int(Int(Rg - (An * 360)) / 30)
chaine = chaine & Mois & " Mois "
'Jours
Jour = (Rg - (An * 360) - (Mois * 30))
If Jour > 0 Then
* chaine = chaine&jour
If Jour = 1 Then
chaine=chaine&" Jour"
Else
chaine=chaine&" Jours"
End If
End If
End If
ModFormat = chaine
End Function


Veuillez me pardonner pour mon ignorance et un grand merci pour vos
conseils.

Bonne journée