Function periode(Optional lig As Long = 2)
Application.Volatile 'selon le besoin…
Dim Sh As Worksheet, c As Range
Dim t As Integer, Cpte As Integer
For Each Sh In Sheets
If Sh.Name = "septembre" or Sh.Name = "octobre" Then
If lig = 0 Then lig = 4
Set c = Sh.Range("C" & lig)
Do While IsDate(Sh.Cells(1, c.Column))
If c = "A" Or IsEmpty(c) = True Then
Cpte = Cpte + 1
Else
Cpte = 0
End If
If periode < Cpte Then periode = Cpte
Set c = c(1, 2)
Loop
End If
Next
End Function