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

I have a workbook with 12-30 worksheets that are in the same format. I want
to create identical headers for all of them, distinguished only by including
the value of, say, cell B4 as part of the header text.
I have two questions:
(1) How do I get a variable cell-value into any header?
(2) I know how to give any new worksheet the same header as an existing
worksheet, but is there any way of creating a default header that will
automatically attach itself to newly-created worksheets?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 168
Default How do I include a cell-value in Excel header?

For the header, just use concatenation.
="Title you want "&B4
or
="Title "&B4&" rest of title"
or
=B4&" Title you want"

You could create a template sheet that has your headers and no data, then
whenever you need to make a new sheet, you just copy the template sheet.

- KC
--
Please remember to indicate when the post is answered so others can benefit
from it later.


"Hershmab" wrote:

I have a workbook with 12-30 worksheets that are in the same format. I want
to create identical headers for all of them, distinguished only by including
the value of, say, cell B4 as part of the header text.
I have two questions:
(1) How do I get a variable cell-value into any header?
(2) I know how to give any new worksheet the same header as an existing
worksheet, but is there any way of creating a default header that will
automatically attach itself to newly-created worksheets?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,069
Default How do I include a cell-value in Excel header?

Try the code
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet
.PageSetup.CenterHeader = .Range("b4").Text
End With
End Sub
--
John
MOS Master Instructor Office 2000, 2002 & 2003
Please reply & rate any replies you get

Ice Hockey rules (especially the Wightlink Raiders)


"Hershmab" wrote:

I have a workbook with 12-30 worksheets that are in the same format. I want
to create identical headers for all of them, distinguished only by including
the value of, say, cell B4 as part of the header text.
I have two questions:
(1) How do I get a variable cell-value into any header?
(2) I know how to give any new worksheet the same header as an existing
worksheet, but is there any way of creating a default header that will
automatically attach itself to newly-created worksheets?

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

Would that be the value of B4 on each sheet or B4 from one sheet replicated to
all sheets?

1. Whichever the case, you would require a macro to do this.

2. You can create a sheet template that has a header of your choosing, but
would be hard-coded.

Easiest is to just insert the sheet then run the macro to add the selectable
header to that new sheet.

Sub Sheet1_Cell_In_AllHeaders()
Dim WS As Worksheet
For Each WS In ActiveWorkbook.Sheets
WS.PageSetup.LeftHeader = Sheets(1).Range("B4").Value
Next
End Sub


Sub Sheet_Cell_In_SheetlHeader()
Dim WS As Worksheet
For Each WS In ActiveWorkbook.Sheets
WS.PageSetup.LeftHeader = WS.Range("B4").Value
Next
End Sub


Gord Dibben MS Excel MVP


On Sat, 17 Feb 2007 11:51:05 -0800, Hershmab
wrote:

I have a workbook with 12-30 worksheets that are in the same format. I want
to create identical headers for all of them, distinguished only by including
the value of, say, cell B4 as part of the header text.
I have two questions:
(1) How do I get a variable cell-value into any header?
(2) I know how to give any new worksheet the same header as an existing
worksheet, but is there any way of creating a default header that will
automatically attach itself to newly-created worksheets?


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
How can I include a variable in an Excel page header omstefanov Excel Discussion (Misc queries) 0 January 10th 07 07:41 PM
How do I include file name and path in the header? Matthew Connellan Excel Discussion (Misc queries) 4 May 23rd 06 04:50 PM
how to include a variable in the header and/or footer of a worksheet tmacke Excel Discussion (Misc queries) 2 April 14th 06 10:13 PM
How can I include bmp file in excel 2000 header? siv Excel Worksheet Functions 1 November 4th 05 02:58 PM
How can I include the name of the tab in a header without typing . kasaz Excel Worksheet Functions 1 February 25th 05 12:43 AM


All times are GMT +1. The time now is 09:36 PM.

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

About Us

"It's about Microsoft Excel"