Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
tmacke
 
Posts: n/a
Default how to include a variable in the header and/or footer of a worksheet


Hi, I am building a template to be used by multiple teams. I would like
them to enter their team name once in the first worksheet of a multi
sheet workbook. I would like to have the team name appear in the header
and footer of each worksheet also without having to modify the header or
footer manually. Is there a way to do this?


--
tmacke
------------------------------------------------------------------------
tmacke's Profile: http://www.excelforum.com/member.php...o&userid=16817
View this thread: http://www.excelforum.com/showthread...hreadid=532985

  #2   Report Post  
Posted to microsoft.public.excel.misc
Casey
 
Posts: n/a
Default how to include a variable in the header and/or footer of a worksheet


Hi,
In the example below the Team puts there name in a cell that is a named
range called TeamName.
INSERT NAME DEFINE
This named range is on a worksheet named Entry Sheet.
Change both of these to suit.

Place this code in the ThisWorkbook module.
Right click a worksheet tab choose view code.
Double click ThisWorkbook

Option Explicit

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Call AddNameToHeadFoot
End Sub
Private Sub AddNameToHeadFoot()
Dim str As String
str = Sheets("Entry Sheet").Range("TeamName").Value 'Modify sheet name
and named range to suit
ActiveSheet.PageSetup.RightFooter = "&""""&10" & str '<==== 10 is
font size
ActiveSheet.PageSetup.RightHeader = "&""""&10" & str '<==== 10 is
font size
End Sub

You can use these variables to place the team names in different areas
of the headers and footers
.LeftHeader
.CenterHeader
.RightHeader
.LeftFooter
.CenterFooter
.RightFooter


HTH


--
Casey


------------------------------------------------------------------------
Casey's Profile: http://www.excelforum.com/member.php...fo&userid=4545
View this thread: http://www.excelforum.com/showthread...hreadid=532985

  #3   Report Post  
Posted to microsoft.public.excel.misc
Ron2005
 
Posts: n/a
Default how to include a variable in the header and/or footer of a worksheet

if by header you simply mean the top of the other tabs then in the sell
you want it to appear on enter:

='sheetnameoffirstworksheet!(A10) change A10 to the cell
number where it is on the first 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 custom headers be linked to a cell in the worksheet? Texas_Toast Excel Discussion (Misc queries) 9 December 14th 05 01:25 AM
Need help updating my macro to include a 2nd worksheet. billrl34 Excel Worksheet Functions 0 December 9th 05 08:06 PM
One worksheet to calulate different items simultaneously John Excel Worksheet Functions 4 November 28th 05 07:07 PM
Conversion of Cell Contents into a Functional Worksheet name ? GMJT Excel Worksheet Functions 1 August 21st 05 04:59 PM
Reference Data in Moved Worksheet tommcbrny Setting up and Configuration of Excel 1 December 1st 04 06:49 PM


All times are GMT +1. The time now is 04:14 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"