A partir d'une date de d=E9but et d'une date fin je voudrais=20
conna=EEtre le nombre de jour ouvr=E9 ,r=E9parti par num=E9ro de=20
semaine(s).
Ex : D=E9b : 8/08/03 Fin :20/08/03 =20
J S
1-32=20
4-33
3-34
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Galfi
Il me sembla avoir vu un truc du genre sur le site http://www.vbfrance.com
"D.LEVISTRE" a écrit dans le message de news:050001c39a30$3fecb110$ A partir d'une date de début et d'une date fin je voudrais connaître le nombre de jour ouvré ,réparti par numéro de semaine(s). Ex : Déb : 8/08/03 Fin :20/08/03 J S 1-32 4-33 3-34
Si possible en VBA Merci
Il me sembla avoir vu un truc du genre sur le site http://www.vbfrance.com
"D.LEVISTRE" <d.levistre@wanadoo.fr> a écrit dans le message de
news:050001c39a30$3fecb110$a001280a@phx.gbl...
A partir d'une date de début et d'une date fin je voudrais
connaître le nombre de jour ouvré ,réparti par numéro de
semaine(s).
Ex : Déb : 8/08/03 Fin :20/08/03
J S
1-32
4-33
3-34
Il me sembla avoir vu un truc du genre sur le site http://www.vbfrance.com
"D.LEVISTRE" a écrit dans le message de news:050001c39a30$3fecb110$ A partir d'une date de début et d'une date fin je voudrais connaître le nombre de jour ouvré ,réparti par numéro de semaine(s). Ex : Déb : 8/08/03 Fin :20/08/03 J S 1-32 4-33 3-34
Si possible en VBA Merci
AV
A partir d'une date de début et d'une date fin je voudrais connaître le nombre de jour ouvré ,réparti par numéro de semaine(s).
Avec noms définis dans le classeur : "DatD" = date de début d'examen "DatF" = date de fin d'examen "JFrs" = Les jours fériés
Sub JoursOuv_et_NumSem1() [A:B].ClearContents [A1] = "Jours Ouvrés": [B1] = "N° Sem" z = 1 For i = [DatD] To [DatF] If Weekday(i * 1, 2) < 6 And IsError(Application.Match(i * 1, [JFrs], 0)) _ Then nbreJ = nbreJ + 1 If Range("B" & z) <> DatePart("ww", i, 2, 2) Then Range("B" & z + 1) = DatePart("ww", i + 1, 2, 2) z = z + 1 End If If Weekday(i * 1, 2) = 7 Or i = [DatF] Then Range("A" & z) = nbreJ nbreJ = 0 End If Next i End Sub 'AV
Autre (Exclusivement pour le fun !) Sub JoursOuv_et_NumSem2() [A:B].ClearContents [A1] = "Jours Ouvrés": [B1] = "N° Sem" z = 1 For i = [DatD] To [DatF] If Range("B" & z) <> DatePart("ww", i, 2, 2) Then d1 = i * 1 d2 = Application.Min(Evaluate(d1 & "+(8-weekday(" & d1 & "))"), [DatF]) ActiveWorkbook.Names.Add Name:="débS", RefersTo:Ñ ActiveWorkbook.Names.Add Name:="finS", RefersTo:Ò Range("B" & z + 1) = DatePart("ww", i + 1, 2, 2) Range("A" & z + 1) Evaluate("sum(int((finS-weekday(finS-{1;2;3;4;5})-débS+8)/7))-sum((JFrs>=débS)*( JFrs<=finS)*(weekday(JFrs,2)<6))") z = z + 1 End If Next i ActiveWorkbook.Names("débS").Delete ActiveWorkbook.Names("finS").Delete End Sub 'AV
PS : dans la "solution fun", les instructions Range("A" & z + 1) = ........2)<6))") sont sur une seule ligne !
AV
A partir d'une date de début et d'une date fin je voudrais
connaître le nombre de jour ouvré ,réparti par numéro de
semaine(s).
Avec noms définis dans le classeur :
"DatD" = date de début d'examen
"DatF" = date de fin d'examen
"JFrs" = Les jours fériés
Sub JoursOuv_et_NumSem1()
[A:B].ClearContents
[A1] = "Jours Ouvrés": [B1] = "N° Sem"
z = 1
For i = [DatD] To [DatF]
If Weekday(i * 1, 2) < 6 And IsError(Application.Match(i * 1, [JFrs], 0)) _
Then nbreJ = nbreJ + 1
If Range("B" & z) <> DatePart("ww", i, 2, 2) Then
Range("B" & z + 1) = DatePart("ww", i + 1, 2, 2)
z = z + 1
End If
If Weekday(i * 1, 2) = 7 Or i = [DatF] Then
Range("A" & z) = nbreJ
nbreJ = 0
End If
Next i
End Sub 'AV
Autre (Exclusivement pour le fun !)
Sub JoursOuv_et_NumSem2()
[A:B].ClearContents
[A1] = "Jours Ouvrés": [B1] = "N° Sem"
z = 1
For i = [DatD] To [DatF]
If Range("B" & z) <> DatePart("ww", i, 2, 2) Then
d1 = i * 1
d2 = Application.Min(Evaluate(d1 & "+(8-weekday(" & d1 & "))"),
[DatF])
ActiveWorkbook.Names.Add Name:="débS", RefersTo:Ñ
ActiveWorkbook.Names.Add Name:="finS", RefersTo:Ò
Range("B" & z + 1) = DatePart("ww", i + 1, 2, 2)
Range("A" & z + 1) Evaluate("sum(int((finS-weekday(finS-{1;2;3;4;5})-débS+8)/7))-sum((JFrs>=débS)*(
JFrs<=finS)*(weekday(JFrs,2)<6))")
z = z + 1
End If
Next i
ActiveWorkbook.Names("débS").Delete
ActiveWorkbook.Names("finS").Delete
End Sub 'AV
PS : dans la "solution fun", les instructions
Range("A" & z + 1) = ........2)<6))")
sont sur une seule ligne !
A partir d'une date de début et d'une date fin je voudrais connaître le nombre de jour ouvré ,réparti par numéro de semaine(s).
Avec noms définis dans le classeur : "DatD" = date de début d'examen "DatF" = date de fin d'examen "JFrs" = Les jours fériés
Sub JoursOuv_et_NumSem1() [A:B].ClearContents [A1] = "Jours Ouvrés": [B1] = "N° Sem" z = 1 For i = [DatD] To [DatF] If Weekday(i * 1, 2) < 6 And IsError(Application.Match(i * 1, [JFrs], 0)) _ Then nbreJ = nbreJ + 1 If Range("B" & z) <> DatePart("ww", i, 2, 2) Then Range("B" & z + 1) = DatePart("ww", i + 1, 2, 2) z = z + 1 End If If Weekday(i * 1, 2) = 7 Or i = [DatF] Then Range("A" & z) = nbreJ nbreJ = 0 End If Next i End Sub 'AV
Autre (Exclusivement pour le fun !) Sub JoursOuv_et_NumSem2() [A:B].ClearContents [A1] = "Jours Ouvrés": [B1] = "N° Sem" z = 1 For i = [DatD] To [DatF] If Range("B" & z) <> DatePart("ww", i, 2, 2) Then d1 = i * 1 d2 = Application.Min(Evaluate(d1 & "+(8-weekday(" & d1 & "))"), [DatF]) ActiveWorkbook.Names.Add Name:="débS", RefersTo:Ñ ActiveWorkbook.Names.Add Name:="finS", RefersTo:Ò Range("B" & z + 1) = DatePart("ww", i + 1, 2, 2) Range("A" & z + 1) Evaluate("sum(int((finS-weekday(finS-{1;2;3;4;5})-débS+8)/7))-sum((JFrs>=débS)*( JFrs<=finS)*(weekday(JFrs,2)<6))") z = z + 1 End If Next i ActiveWorkbook.Names("débS").Delete ActiveWorkbook.Names("finS").Delete End Sub 'AV
PS : dans la "solution fun", les instructions Range("A" & z + 1) = ........2)<6))") sont sur une seule ligne !