#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 28
Default Dynamic Header

Hi! I have a worksheet where I need the Header to change based on a cell
value(V4)... Is this possible? I have worked through several VBA's but they
dont seem to do the trick. Thanks for any help!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,355
Default Dynamic Header

I've done this with Workbook_BeforePrint Macro. Put this in the ThisWorkbook
Module.

Sub Workbook_BeforePrint(Cancel As Boolean)

'The headers are updated to include the program name and the last save time
'each time the workbook is printed

Application.ScreenUpdating = False
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ActiveSheet.Range("V4").text
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.CenterHorizontally = True
.CenterVertically = False
End With
Application.ScreenUpdating = True
End Sub

--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"JAbels001" wrote:

Hi! I have a worksheet where I need the Header to change based on a cell
value(V4)... Is this possible? I have worked through several VBA's but they
dont seem to do the trick. Thanks for any help!

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,346
Default Dynamic Header

Hi,

Add this one line to a BeforePrint macro

ActiveSheet.PageSetup.LeftHeader = [V4]

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"JAbels001" wrote:

Hi! I have a worksheet where I need the Header to change based on a cell
value(V4)... Is this possible? I have worked through several VBA's but they
dont seem to do the trick. Thanks for any help!

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 28
Default Dynamic Header

That VBA isnt working for me. Is it possible that I setup it up wrong? It's
placed on the tab I need to print as General... Is there anything else?

"Barb Reinhardt" wrote:

I've done this with Workbook_BeforePrint Macro. Put this in the ThisWorkbook
Module.

Sub Workbook_BeforePrint(Cancel As Boolean)

'The headers are updated to include the program name and the last save time
'each time the workbook is printed

Application.ScreenUpdating = False
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ActiveSheet.Range("V4").text
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.CenterHorizontally = True
.CenterVertically = False
End With
Application.ScreenUpdating = True
End Sub

--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"JAbels001" wrote:

Hi! I have a worksheet where I need the Header to change based on a cell
value(V4)... Is this possible? I have worked through several VBA's but they
dont seem to do the trick. Thanks for any help!

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 28
Default Dynamic Header

I got it to work! Thanks!

"Shane Devenshire" wrote:

Hi,

Add this one line to a BeforePrint macro

ActiveSheet.PageSetup.LeftHeader = [V4]

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"JAbels001" wrote:

Hi! I have a worksheet where I need the Header to change based on a cell
value(V4)... Is this possible? I have worked through several VBA's but they
dont seem to do the trick. Thanks for any help!

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
Omit header from first page without embedding header in code ibvalentine Excel Worksheet Functions 6 August 28th 07 05:10 AM
Excel-Header-My Company Name won't work in Header (AT&T) & Time June K Excel Discussion (Misc queries) 2 April 10th 06 08:36 PM
Help with copying dynamic column selected based on remote cell value and dynamic formula fill ers Charts and Charting in Excel 0 March 1st 06 01:05 AM
Dynamic Range with unused formula messing up x axis on dynamic graph [email protected] Charts and Charting in Excel 2 February 2nd 06 08:02 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 01:25 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"