Column headers appearing on every page

G

Guest

When using page breaks, my column headers appear on the top of each page.

However I want to the last page of the the sheet to not show these headers
but cannot find a way to do this.

Please note these are column headers and not 'header/footer' headers.

Any help would be appreciated!

Thanks
Craig
 
G

Gord Dibben

Craig

I assume you have "rows to repeat at top" set to row 1 which is your title row.

With this setting it all or nothing unless you employ some VBA.

Here is a revision of a Ron de Bruin macro which will suppress the title row on
last page.

Sub Test()
Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
ActiveSheet.PrintOut From:=1, To:=TotPages - 1
.PrintTitleRows = False
ActiveSheet.PrintOut From:=TotPages, To:=TotPages
End With
End Sub


Gord Dibben MS Excel MVP
 
G

Guest

That's great. Thanks Gord!

Craig

Gord Dibben said:
Craig

I assume you have "rows to repeat at top" set to row 1 which is your title row.

With this setting it all or nothing unless you employ some VBA.

Here is a revision of a Ron de Bruin macro which will suppress the title row on
last page.

Sub Test()
Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
ActiveSheet.PrintOut From:=1, To:=TotPages - 1
.PrintTitleRows = False
ActiveSheet.PrintOut From:=TotPages, To:=TotPages
End With
End Sub


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top