Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default How do I set a custom header to a cell value in Excel 2003?

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.
  #2   Report Post  
Posted to microsoft.public.excel.misc
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.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 320
Default How do I set a custom header to a cell value in Excel 2003?

You need VBA code to change the header. In the VBE, double-click the
"ThisWorkbook" section, then in the top/left dropdown, select Workbook, in
the top right dropdown select BeforePrint, then enter this (make adjustments
accordingly):

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.LeftHeader = Range("F3").Value
End Sub

"Siggy" wrote in message
...
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.



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default How do I set a custom header to a cell value in Excel 2003?

Sub CellInHeader()
With ActiveSheet.PageSetup
.LeftHeader = "&""Algerian,Regular""&16" & Range("A1").Value
End With
End Sub

Or without any formatting..................

Sub CellInFooter()
With ActiveSheet
.PageSetup.CenterFooter = .Range("A1").Value
End With
End Sub


Gord Dibben MS Excel MVP

On Wed, 2 Sep 2009 12:01:03 -0700, 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.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can you link a custom property to an Excel custom header text? LouErc Setting up and Configuration of Excel 0 November 8th 05 04:58 PM
Excel: custom header - is it possible to paste into header? Maureen D. Excel Worksheet Functions 0 November 4th 05 03:07 PM
excel - insert cell contents in a custom header / footer b Excel Discussion (Misc queries) 0 August 25th 05 06:51 PM
Enter an Excel cell reference as part of a custom header/footer Suegi123 Excel Worksheet Functions 1 April 1st 05 10:55 PM
how do I permanetly add custom header to excel header list? GARY Excel Discussion (Misc queries) 1 December 15th 04 08:52 PM


All times are GMT +1. The time now is 11:44 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"