Sub test()
nbPages = ActiveSheet.PageSetup.Pages.Count
x = numeroPage(Range("A147"))
ActiveSheet.PageSetup.PrintTitleRows = "$1:$8"
For k = 147 To 169
If numeroPage(Range("A" & k)) <> x Then
ActiveSheet.PrintOut from:=1, To:=nbPages - 1
ActiveSheet.PageSetup.PrintTitleRows = ""
ActiveSheet.PrintOut from:=nbPages, To:=nbPages
Exit Sub
End If
Next
ActiveSheet.PrintOut from:=1, To:=nbPages
End Sub