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
   | Private Sub ComboBox1_Change()
Dim d As String
Dim d2 As Date
Dim Laval As Single
Dim Fl1 as worksheet
Dim Plage as range, Cell as range
     Set Fl1 = Worksheets("Feuil1")
     d = FL1.ComboBox2.Value
     d2 = FL1.ComboBox1.Value
     Set Plage = Fl1.Range("DR4:DR" & FL1.Range("DR4").End(xlDown).Row)
    For Each Cell In Plage 'ou cell est la cellule "examinée"
    'Comme Plage démarre à DR4, tes offsets doivent le prendre en compte.
    'J'ai essayé de comprendre pour adapter mais tu vérifies.
    'Pour ça, il suffit de savoir que Cell.row te donne le N° de ligne en cours
    
        If Cell.Offset(0, 1) = d2 Then
            If d = "Tous" Then
                 LaVal = LaVal + 1
            End If
    
            If Cell.Offset(-1, -34) = d Then '
                 LaVal = LaVal + 1
            End If
     
        End If
    Next
    
    Worksheets("Feuil1").Range("G8").Offset(1, 1) = LaVal
    LaVal = 0
End Sub | 
Partager