Sub test()
suppNomsPage "En_tête"
nommerPages "En_tête"
End Sub
Sub nommerPages(nomF As String)
Dim HPB As HPageBreak, numP As Long, nom As String
Dim pl As Range, lig As Long, col1 As Long, nbCol As Long, derlig As Long
ActiveWindow.View = xlPageBreakPreview
With Sheets(nomF)
On Error GoTo fin
Set pl = Range(.PageSetup.PrintArea)
On Error GoTo 0
col1 = pl.Column: nbCol = pl.Columns.Count: derlig = pl.Row + pl.Rows.Count - 1
lig = pl.Row
For Each HPB In .HPageBreaks
numP = numP + 1
Set pl = .Cells(lig, col1).Resize(HPB.Location.Row - lig, nbCol)
nom = nomF & "!page_" & Format(numP, "00")
pl.Name = nom
lig = HPB.Location.Row
Next HPB
If lig < derlig Then
numP = numP + 1
Set pl = .Cells(lig, col1).Resize(derlig - lig + 1, nbCol)
nom = nomF & "!page_" & Format(numP, "00")
pl.Name = nom
End If
End With
fin:
End Sub
Sub suppNomsPage(nomF As String)
Dim nom As Name
For Each nom In ActiveWorkbook.Names
If Left(nom.Name, Len(nomF) + 6) = nomF & "!page_" Then nom.Delete
Next nom
End Sub