OVH Cloud OVH Cloud

Erreur avec Fonction trouve sur MPFE

7 réponses
Avatar
LeSurCitaire
Bonjour,
j'ai trouve cette macro
Function TYPEJOUR(D As Date)
'L. Longre
Dim A As Integer, T As Integer
Dim LP As Date, LD As Long
Dim Toto As Long

A =3D Year(D)
If A > 2099 Then
TYPEJOUR =3D CVErr(xlErrValue)
Exit Function
End If
LD =3D Int(D)
If LD <=3D 2 Then
If LD =3D 1 Then TYPEJOUR =3D 2
Exit Function
End If
T =3D (((255 - 11 * (A Mod 19)) - 21) Mod 30) + 21
LP =3D DateSerial(A, 3, 2) + T + (T > 48) _
+ 6 - ((A + A \ 4 + T + (T > 48) + 1) Mod 7)
Select Case D
' Jours f=E9ri=E9s mobiles
Case Is =3D LP, Is =3D LP + 38, Is =3D LP + 49
TYPEJOUR =3D 2
' Jours f=E9ri=E9s fixes
Case Is =3D DateSerial(A, 1, 1), Is =3D DateSerial(A, 5, 1), _
Is =3D DateSerial(A, 5, 8), Is =3D DateSerial(A, 7, 14), _
Is =3D DateSerial(A, 8, 15), Is =3D DateSerial(A, 11, 1), _
Is =3D DateSerial(A, 11, 11), Is =3D DateSerial(A, 12, 25)
TYPEJOUR =3D 2
Case Else
' Samedi ou dimanche
If Weekday(D, vbMonday) >=3D 6 Then TYPEJOUR =3D 1
End Select
End Function

et quand je rentre dans mFC =3DTYPEJOUR(B4)=3D2 cela ne fonctione pas et je
retrouve ceci dans la MFC =3D"=3DTYPEJOUR(B4)=3D2"

je ne volis pas ce qui cloche

7 réponses

Avatar
RGI
bonjour

elle fonctionne très bien

si en A2 tu as une date

dans une autre cellule de ton choix tu peux inscrire ceci

=SI(TYPEJOUR(A2)=0;"Normal";SI(TYPEJOUR(A2)=1;"weekend";SI(TYPEJOUR(A2)=2;"férié";"")))

salutations

Gilbert

"LeSurCitaire" a écrit dans le message
de news:
Bonjour,
j'ai trouve cette macro
Function TYPEJOUR(D As Date)
'L. Longre
Dim A As Integer, T As Integer
Dim LP As Date, LD As Long
Dim Toto As Long

A = Year(D)
If A > 2099 Then
TYPEJOUR = CVErr(xlErrValue)
Exit Function
End If
LD = Int(D)
If LD <= 2 Then
If LD = 1 Then TYPEJOUR = 2
Exit Function
End If
T = (((255 - 11 * (A Mod 19)) - 21) Mod 30) + 21
LP = DateSerial(A, 3, 2) + T + (T > 48) _
+ 6 - ((A + A 4 + T + (T > 48) + 1) Mod 7)
Select Case D
' Jours fériés mobiles
Case Is = LP, Is = LP + 38, Is = LP + 49
TYPEJOUR = 2
' Jours fériés fixes
Case Is = DateSerial(A, 1, 1), Is = DateSerial(A, 5, 1), _
Is = DateSerial(A, 5, 8), Is = DateSerial(A, 7, 14), _
Is = DateSerial(A, 8, 15), Is = DateSerial(A, 11, 1), _
Is = DateSerial(A, 11, 11), Is = DateSerial(A, 12, 25)
TYPEJOUR = 2
Case Else
' Samedi ou dimanche
If Weekday(D, vbMonday) >= 6 Then TYPEJOUR = 1
End Select
End Function

et quand je rentre dans mFC =TYPEJOUR(B4)=2 cela ne fonctione pas et je
retrouve ceci dans la MFC ="=TYPEJOUR(B4)=2"

je ne volis pas ce qui cloche
Avatar
Yvan
Bonjour *LeSurCitaire*

J'ai fait la même expérience et j'ai eu le même résultat. Seulement, l'avais
oublié de taper le premier signe =.

En recommençant avec le signe = en début de condition, çà fanctionne
parfaitement.

@+

Yvan

"LeSurCitaire" a écrit dans le message
de news:
Bonjour,
j'ai trouve cette macro
Function TYPEJOUR(D As Date)
'L. Longre
Dim A As Integer, T As Integer
Dim LP As Date, LD As Long
Dim Toto As Long

A = Year(D)
If A > 2099 Then
TYPEJOUR = CVErr(xlErrValue)
Exit Function
End If
LD = Int(D)
If LD <= 2 Then
If LD = 1 Then TYPEJOUR = 2
Exit Function
End If
T = (((255 - 11 * (A Mod 19)) - 21) Mod 30) + 21
LP = DateSerial(A, 3, 2) + T + (T > 48) _
+ 6 - ((A + A 4 + T + (T > 48) + 1) Mod 7)
Select Case D
' Jours fériés mobiles
Case Is = LP, Is = LP + 38, Is = LP + 49
TYPEJOUR = 2
' Jours fériés fixes
Case Is = DateSerial(A, 1, 1), Is = DateSerial(A, 5, 1), _
Is = DateSerial(A, 5, 8), Is = DateSerial(A, 7, 14), _
Is = DateSerial(A, 8, 15), Is = DateSerial(A, 11, 1), _
Is = DateSerial(A, 11, 11), Is = DateSerial(A, 12, 25)
TYPEJOUR = 2
Case Else
' Samedi ou dimanche
If Weekday(D, vbMonday) >= 6 Then TYPEJOUR = 1
End Select
End Function

et quand je rentre dans mFC =TYPEJOUR(B4)=2 cela ne fonctione pas et je
retrouve ceci dans la MFC ="=TYPEJOUR(B4)=2"

je ne volis pas ce qui cloche
Avatar
Modeste
Bonsour® LeSurCitaire
:-(((
Hélas les Formules de MEFC n'acceptent que les fonctions standards EXCEL
ni fonctions complémentaires, ni fonctions Perso ...
Désolé !!!
--
n'oubliez pas les FAQ :
http://www.excelabo.net http://dj.joss.free.fr/faq.htm
http://www.faqoe.com http://faqword.free.fr
--
Feed Back
http://viadresse.com/?94912042
Avatar
RGI
ou

=SI(TYPEJOUR(A2)=0;"0";SI(TYPEJOUR(A2)=1;"1";SI(TYPEJOUR(A2)=2;"2";"")))

ensuite dans cette cellule tu mets ta MFC

salutations

Gilbert

"RGI" a écrit dans le message de news:
43157d4c$0$1711$
bonjour

elle fonctionne très bien

si en A2 tu as une date

dans une autre cellule de ton choix tu peux inscrire ceci

=SI(TYPEJOUR(A2)=0;"Normal";SI(TYPEJOUR(A2)=1;"weekend";SI(TYPEJOUR(A2)=2;"férié";"")))

salutations

Gilbert

"LeSurCitaire" a écrit dans le message
de news:
Bonjour,
j'ai trouve cette macro
Function TYPEJOUR(D As Date)
'L. Longre
Dim A As Integer, T As Integer
Dim LP As Date, LD As Long
Dim Toto As Long

A = Year(D)
If A > 2099 Then
TYPEJOUR = CVErr(xlErrValue)
Exit Function
End If
LD = Int(D)
If LD <= 2 Then
If LD = 1 Then TYPEJOUR = 2
Exit Function
End If
T = (((255 - 11 * (A Mod 19)) - 21) Mod 30) + 21
LP = DateSerial(A, 3, 2) + T + (T > 48) _
+ 6 - ((A + A 4 + T + (T > 48) + 1) Mod 7)
Select Case D
' Jours fériés mobiles
Case Is = LP, Is = LP + 38, Is = LP + 49
TYPEJOUR = 2
' Jours fériés fixes
Case Is = DateSerial(A, 1, 1), Is = DateSerial(A, 5, 1), _
Is = DateSerial(A, 5, 8), Is = DateSerial(A, 7, 14), _
Is = DateSerial(A, 8, 15), Is = DateSerial(A, 11, 1), _
Is = DateSerial(A, 11, 11), Is = DateSerial(A, 12, 25)
TYPEJOUR = 2
Case Else
' Samedi ou dimanche
If Weekday(D, vbMonday) >= 6 Then TYPEJOUR = 1
End Select
End Function

et quand je rentre dans mFC =TYPEJOUR(B4)=2 cela ne fonctione pas et je
retrouve ceci dans la MFC ="=TYPEJOUR(B4)=2"

je ne volis pas ce qui cloche




Avatar
AV
Hélas les Formules de MEFC ..........
, ni fonctions Perso ...


Heu... il me semble que si !
;-)
AV

Avatar
AV
Pour une(des) MEFC et notamment ton problème de Jours fériés et/ou W.E., ne
manque pas de consulter ici :

http://www.excelabo.net/moteurs/compteclic.php?nom=av-mefc

notamment "Les Jours fériés et WE dans calendrier" dans la rubrique "Date et
heures"
(sans macro complémentaires ni fonction perso)

AV
Avatar
Modeste
Houpps !!!
Heu... oui....
celles des classeurs ouverts ;o))
des fonctions perso je ne sais même plus dans quel classeur elles se
trouvent ;o)))

AV wrote:
Hélas les Formules de MEFC ..........
, ni fonctions Perso ...


Heu... il me semble que si !
;-)
AV


--
n'oubliez pas les FAQ :
http://www.excelabo.net http://dj.joss.free.fr/faq.htm
http://www.faqoe.com http://faqword.free.fr
--
Feed Back
http://viadresse.com/?94912042