J'ai aussi repris mon fichier sur lequel j'ai avancé, et collé la formule en D12 mais rien ne se passe...
Mais avez-vous récupéré et copié le code qui va avec dans le module VBA, à la suite de la fonction CountColor?
Function Ampl(Plage As Range, Ligne As Long) As Long
Dim HeureDeb As Long, HeureFin As Long, i As Long, DerCol As Long
DerCol = Range("ZZ8").End(xlToLeft).Column
For i = 6 To DerCol
If HeureDeb = 0 Then
If Cells(Ligne, i).Interior.ColorIndex <> xlNone Then
If Cells(8, i) = "" Then
HeureDeb = Cells(8, i - 1)
GoTo Heure_Fin
Else
HeureDeb = Cells(8, i)
GoTo Heure_Fin
End If
End If
End If
Next i
Heure_Fin:
For i = DerCol To 6 Step -1
If HeureFin = 0 Then
If Cells(Ligne, i).Interior.ColorIndex <> xlNone Then
If Cells(8, i) = "" Then
HeureFin = Cells(8, i - 1) + 1
Ampl = HeureFin - HeureDeb
Else
HeureFin = Cells(8, i)
Ampl = HeureFin - HeureDeb
End If
End If
End If
Next i
End Function