Sub test()
Dim MonSaut As HPageBreak, Ligne As Long, I As Integer, Planning As Integer
Planning = Application.InputBox("N° de planning ?", "Selection", , , , , , 1)
I = 1
If Range("A2") = Planning Then
With ActiveSheet.PageSetup
.CenterHeader = "&""-,Gras""&24Plannings N° " & Range("A2").Value
End With
ExecuteExcel4Macro "PRINT(2," & I & "," & I & ",1,,,,,,,,2,,,TRUE,,FALSE)"
End If
For Each MonSaut In ActiveSheet.HPageBreaks
I = I + 1
Ligne = MonSaut.Location.Row
If Range("A" & Ligne + 1) = Planning Then
With ActiveSheet.PageSetup
.CenterHeader = "&""-,Gras""&24Plannings N° " & Range("A" & Ligne + 1).Value
End With
ExecuteExcel4Macro "PRINT(2," & I & "," & I & ",1,,,,,,,,2,,,TRUE,,FALSE)"
End If
Next MonSaut
End Sub