Option Explicit
Sub Reorganise()
Dim a, b(), i As Long, j As Long, k As Long, n As Long
Application.ScreenUpdating = False
a = Sheets("planning").Range("B4").CurrentRegion.Value
ReDim b(1 To UBound(a, 1) * UBound(a, 2), 1 To 7)
For i = 2 To UBound(a, 2)
If (i - 2) Mod 6 = 0 Then
k = 2: n = n + 1
b(n, 1) = a(1, i)
End If
For j = 3 To UBound(a, 1)
If a(j, i) <> "" Then
b(n, k) = a(j, 1)
Exit For
End If
Next
k = k + 1
Next
'Restitution et mise en forme
With Sheets("récapt").Cells(1).Resize(, 7)
.CurrentRegion.Clear
.Value = Array("", "histoire", "géographie", "maths", "français", "anglais", "lecture")
With .Offset(1).Resize(n)
.Value = b
With .CurrentRegion
.BorderAround ColorIndex:=1, Weight:=xlThin
.Borders(xlInsideVertical).Weight = xlThin
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Font.Name = "calibri"
.Font.Size = 10
With .Rows(1)
.Font.Size = 11
.RowHeight = 18
.BorderAround ColorIndex:=1, Weight:=xlThin
With .Offset(, 1).Resize(, .Columns.Count - 1)
.Interior.ColorIndex = 44
End With
End With
With .Columns(1)
With .Offset(1).Resize(.Rows.Count - 1)
.Interior.ColorIndex = 43
End With
End With
.Parent.Activate
End With
End With
End With
Application.ScreenUpdating = True
End Sub