View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default How do I set a custom header to a cell value in Excel 2003?

Set the security level to low/medium in (Tools|Macro|Security). From workbook
press Alt+F11 to launch VBE (Visual Basic Editor). From the left treeview
search for the workbook name and click on + to expand it. Within that you
should see the following

VBAProject(Your_Filename)
Microsoft Excel Objects
Sheet1(Sheet1)
Sheet2(Sheet2)
Sheet3(Sheet3)
This Workbook

Double click 'This WorkBook' and paste the below code to the right code pane.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.LeftHeader = Sheets("Sheet1").Range("A1")
End Sub

Change the cell reference 'A1' and the sheet name to suit your requirement.
Try print preview...

If this post helps click Yes
---------------
Jacob Skaria


"Siggy" wrote:

I am trying to progam a header so that it matches the data in a spreadsheet
by attaching the header to a cell in the worksheet.