1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| Sub creerFeuilles()
Dim curCell As Range
Set curCell = ThisWorkbook.Sheets("Accueil ").Range("B4")
While curCell.Value <> vbNullString
ThisWorkbook.Sheets.Add After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count).Name = curCell.Value & " " & curCell.Offset(0, 1).Value
ThisWorkbook.Sheets("Accueil ").Hyperlinks.Add Anchor:=curCell.Offset(0, 2), Address:="", SubAddress:= _
"'" & ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count).Name & "'!A1", TextToDisplay:="Acces à laFeuille"
Set curCell = curCell.Offset(1, 0)
Wend
Worksheets.Add After:=Worksheets(Worksheets.Count)
With Worksheets(Worksheets.Count)
.Buttons.Add(84.75, 22.5, 105.75, 25.5).Select
End With
Selection.OnAction = Application.DisplayAlerts = False
ActiveWorkBook.Save
ThisWorkbook.Sheets("Accueil ").Select
'Récuperer le nom de l'onglet
Dim f As Worksheet
For Each f In Worksheets
If f.Name <> "Accueil" Then
f.Range("K1") = f.Name
With f.Range("k1")
' .Borders.Weight = 3
.Font.Bold = True
.Font.Size = 18
.Font.Italic = True
.Font.Name = "Arial"
End With
End If
Next
End Sub |
Partager