Bonjour j'ai un soucis, je cherche à compter le nombre de fois que ce repète le mot ON dans un classeur en fonction de la date saisie mais je n'y arrive pas.
Private Sub productionacejour_Click()
Private Sub productiondatex_Click()
Dim Ws As Worksheet
Dim Mot1 As String
Dim Mot2 As String
Dim Depart As String
Dim LaDate As Date
Dim Compteur As Integer
Dim Cel As Range
Mot1 = InputBox("Entrer la date recherchée au format JJ/MM/AAAA", "titre")
LaDate = CDate(Mot1)
Mot2 = "---- ON ----"
For Each Ws In Sheets
With Ws.Cells
Set Cel = .Find(what:=LaDate, LookIn:=xlValues, lookat:=xlWhole)
If Not Cel Is Nothing Then
Depart = Cel.Address
Do
If InStr(1, Cel.Offset(0, 1), Mot2) > 0 Then
Compteur = Compteur + 1
End If
Set Cel = .FindNext(Cel)
Loop While Depart <> Cel.Address
End If
End With
Next Ws
If Compteur > 0 Then
MsgBox "La Production du " & Mot1 & " est de " & Compteur & " produit(s)"
Else
MsgBox "Aucune production le " & Mot1
End If
End Sub
Cordialement