View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Toppers Toppers is offline
external usenet poster
 
Posts: 4,339
Default Printing to header/footer programatically

Dean,
A starter (from recording a macro as I added header and footer
to a worksheet). Change the header /footer sections as required according to
your selection criteria.

e.g

With ActiveSheet.PageSetup


If condition = criteria then
.LeftHeader=' .... whatever .."
else
.LeftHeader= " ... something else .."
End If
.....

End With



Range("A1:J32").Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$J$32"

With ActiveSheet.PageSetup
' Header Sections .......
.LeftHeader = "My Left Header Section"
.CenterHeader = "My Centre Header Section"
.RightHeader = "My Right Header Section"
' Footer sections .....
.LeftFooter = "My Footer Left"
.CenterFooter = "My Footer Centre"
.RightFooter = "My Footer Right"

End With


HTH


"Dean" wrote:

I would like to be able to set a message to print in the footer/header of a
printed page depending on certain criteria in the spreadsheet.

Can someone suggest/advise how I could go about this.

Thanks in advance
Dean