Headers and Footers

  • Thread starter Thread starter Nath
  • Start date Start date
N

Nath

HI

Can anyone tell me how to or where i can look to set the
headers and footers of a spreadsheet using code.

I need to do this as i have one front end sheet, which is
compiled by code and printed out 8 times with different
results, so i am using a loop and printing each in turn,
so i want to tag on the end "Page number " & x & " of " & y
or similar

TIA

Nathan.
 
Hi
try the following as starting point:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
For Each wkSht In Me.Worksheets
With wkSht.PageSetup
.CenterHeader = wkSht.range("A1").value
.leftHeader = "&P of &N"
End With
Next wkSht
End Sub

This has to go in your workbook module. It will be executed
automaticall
 

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

Back
Top