Option Explicit
Sub Ajout_feuilles_jour()
Dim d As Object, cel As Range, I As Integer, plg As Range, J As Integer
Set d = CreateObject("scripting.dictionary")
With Sheets("tableau")
Set plg = .[A1].CurrentRegion
For Each cel In .Range("A2:A" & .Range("A" & Rows.Count).End(xlUp).Row)
d(Format(cel.Value2, "dddd")) = ""
Next cel
End With
For I = 0 To d.Count - 1
On Error Resume Next
Application.DisplayAlerts = False
Sheets(d.keys()(I)).Delete
Application.DisplayAlerts = True
Sheets.Add After:=Worksheets(Worksheets.Count())
ActiveSheet.Name = d.keys()(I)
plg.Copy Sheets(d.keys()(I)).Range("A2")
'Sheets.Add.Name = d.keys()(i)
With ActiveSheet
For J = Range("a" & Rows.Count).End(xlUp).Row To 4 Step -1
If Format(Range("a" & J).Value, "dddd") <> .Name Then Range("a" & J).EntireRow.Delete
Next J
'copie du logo + mise en forme
Sheets("logo").Shapes("Picture 1").Copy
.Paste Destination:=.Range("A1")
' Image.Width = .Width
'Image.Height = .Height
.Rows(1).RowHeight = Sheets("logo").Shapes("Picture 1").Height
.Range("b1") = .Range("A" & .Range("a" & Rows.Count).End(xlUp).Row)
.Range("b1").NumberFormat = """Formation(s) du ""dddd dd mmmm yyyy"
With .Range("b1:e1")
.Merge
.Font.Bold = True
.Font.Size = 18
.VerticalAlignment = xlCenter
.HorizontalAlignment = xlCenter
End With
' Ajustement largeur colonnes
.Columns("B:E").WrapText = True 'renvoie à la ligne
.Columns("B:B").ColumnWidth = 34
.Columns("C:C").ColumnWidth = 27
.Columns("D:D").ColumnWidth = 21
.Columns("E:E").ColumnWidth = 17
.Columns("A:A, F:F").ColumnWidth = 11
With .Range("D2:E2")
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
End With
End With
Next I
End Sub