PDA

View Full Version : Adding Cell reference as a header prior to print



Ken Puls
01-08-2007, 12:15 PM
Received via PM...


I have a spreadsheet which contains a print button which is linked to a print macro. I would like to incorporate your following suggestion for 'Adding a cell refernce to the header of a sheet' into my print macro. so that everytime someone clicks the print button the following header option activates and then prints the page.

Sub AddHeader_CurrentSheetOnly()
'Add A1 from active sheet to active sheet's header
With ActiveSheet.PageSetup
.LeftHeader = Range("A1").Value
End With
End Sub

All you should need to do is edit your custom print macro. You have two options.

1) Copy the macro as above into a project and then insert the following just before whatever command you use to print in your custom print macro:
Call AddHeader_CurrentSheetOnly

or
2) Edit your print macro to include everything between the Sub and End Sub lines. This avoids the need to call a second macro.

HTH,