Bonjour,

Mon problème est le suivant :
Je souhaite créer une liste comprenant les jours ouvrés du mois en cours.

voici le code que j'utilise :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
'--------------------------------------------------------------------------
'Définition du nb de jours dans le mois
'--------------------------------------------------------------------------
        If Month(Date) = 4 Or Month(Date) = 6 Or Month(Date) = 9 Or Month(Date) = 11 Then
            n = 30
        ElseIf Month(Date) = 2 Then
            If (Year(Date) - 2008) / 4 = Int((Year(Date) - 2008) / 4) Then
                n = 29
            Else
                n = 28
            End If
        Else
            n = 31
        End If
'--------------------------------------------------------------------------
'Fin de Définition du nb de jours dans le mois
'--------------------------------------------------------------------------
        i = 0
        UserForm1.ListBox1.Clear
        'pour chaque jour dans le mois
        For i = 0 To n - 1
            'si le jour n'est ni un samedi ni un dimanche
            If Not Weekday(DateSerial(Year(Date), Month(Date), i + 1)) = 1 Then
                If Not Weekday(DateSerial(Year(Date), Month(Date), i + 1)) = 7 Then
'--------------------------------------------------------------------------
'Définition de la liste (correspondant aux jours ouvrés du mois)
'--------------------------------------------------------------------------
                    For Each c In Fl1.Range("JFERIES")
                        If Month(c.Value) = Month(Date) Then
                            If Not DateSerial(Year(Date), Month(Date), i + 1) = c.Value Then
                                If UserForm1.ListBox1.ListCount > 1 Then
                                    If Not UserForm1.ListBox1.List(UserForm1.ListBox1.ListCount - 1, 0) = DateSerial(Year(Date), Month(Date), i + 1) Then
                                        UserForm1.ListBox1.AddItem (DateSerial(Year(Date), Month(Date), i + 1))
                                    End If
                                Else
                                    UserForm1.ListBox1.AddItem (DateSerial(Year(Date), Month(Date), i + 1))
                                End If
                            End If
                        Else
                            If UserForm1.ListBox1.ListCount > 1 Then
                                If Not UserForm1.ListBox1.List(UserForm1.ListBox1.ListCount - 1, 0) = DateSerial(Year(Date), Month(Date), i + 1) Then
                                    UserForm1.ListBox1.AddItem (DateSerial(Year(Date), Month(Date), i + 1))
                                End If
                            Else
                                UserForm1.ListBox1.AddItem (DateSerial(Year(Date), Month(Date), i + 1))
                            End If
                        End If
                    Next c
'--------------------------------------------------------------------------
'Fin de Définition de la liste
'--------------------------------------------------------------------------
                End If
            End If
        Next i
UserForm1.Show
Le souci est qu'il n'a pas l'air de prendre en compte les conditions pour l'ajout des lignes de la liste.

Je m'explique : ma liste ne me donne bien que les jours ouvrés du mois, mais pour chaque date, j'ai autant de ligne que de cellules comprises dans JFERIES...

Pourquoi ?

Merci de vos contributions