Private Sub Worksheet_Calculate()
Dim C As Range, ResC As String, Cellule As Range, plage As Range
Application.ScreenUpdating = False
Application.EnableEvents = False
Set plage = Range("M12", Cells(Rows.Count, 13).End(xlUp)).Offset(, -7)
Set plage = plage.Resize(plage.Count - 1)
For Each C In Range("M12", Cells(Rows.Count, 13).End(xlUp)).Offset(, -7)
' If C.Row = 24 Then Stop
If C.Offset(, -2) <> "" And C.Offset(, -2) <> ResC Then
Debug.Print C.Address(0, 0)
ResC = C
If Application.CountIf(C.Resize(3), "- -") = 3 And C.Row < 27 Then
If C.Offset(, 1).Resize(3).MergeCells = False Then
Application.DisplayAlerts = False
C.Offset(, 1).Resize(3, 7).Copy Cells(C.Row, 22)
C.Offset(, 1).Resize(3, 7).Validation.Delete
C.Offset(, 1).Resize(3, 7).MergeCells = True
[G42:M44].Copy C.Offset(, 1).Resize(3, 7)
C.Offset(, 1).Resize(3, 7).Interior.Color = C.Interior.Color
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End If
GoTo Fin
End If
If C.Offset(, 1).Resize(3).MergeCells = True Then
C.Offset(, 1).Resize(3, 7).MergeCells = False
Cells(C.Row, 22).Resize(3, 7).Copy C.Offset(, 1)
End If
For Each Cellule In C.Resize(3)
If Cellule.Value = "- -" Then
Cellule.EntireRow.Hidden = True
Else
Cellule.EntireRow.Hidden = False
Application.ScreenUpdating = True
End If
Next Cellule
End If
Fin:
Next C
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub