Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Dates in Header

I have a workbook with about 20 worksheets. I need to be able to change the
date that is typed into the header. Is there a way to reference a cell with
the date that I want as part of my header. Any help or direction would be
nice.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Dates in Header

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.RightFooter = "&""Verdana""&8 " & _
Format(Activesheet.Range("A1").Value, "dd-mm-yyyy")
End Sub

Placed in the ThisWorkbook Module.

--
Regards,
Tom Ogilvy


"Judd Jones" wrote in message
...
I have a workbook with about 20 worksheets. I need to be able to change

the
date that is typed into the header. Is there a way to reference a cell

with
the date that I want as part of my header. Any help or direction would be
nice.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Dates in Header

The information that you gave me works good, but I have tested it with
mulitple sheet selected and it does not update all sheets. Any suggestions.

I also tested the same code as part of the before save function:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
ActiveSheet.PageSetup.CenterHeader = Format(Sheets("data").Range("A1").Text,
"[$-409]mmmm d, yyyy;@")
End Sub

It also will not update all sheets.

"Tom Ogilvy" wrote:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.RightFooter = "&""Verdana""&8 " & _
Format(Activesheet.Range("A1").Value, "dd-mm-yyyy")
End Sub

Placed in the ThisWorkbook Module.

--
Regards,
Tom Ogilvy


"Judd Jones" wrote in message
...
I have a workbook with about 20 worksheets. I need to be able to change

the
date that is typed into the header. Is there a way to reference a cell

with
the date that I want as part of my header. Any help or direction would be
nice.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Dates in Header

You will have to loop through your sheets and execute it.

While manually, you can group sheets and do this, it doesn't work in VBA.

--
Regards,
Tom Ogilvy

"Judd Jones" wrote in message
...
The information that you gave me works good, but I have tested it with
mulitple sheet selected and it does not update all sheets. Any

suggestions.

I also tested the same code as part of the before save function:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As

Boolean)
ActiveSheet.PageSetup.CenterHeader =

Format(Sheets("data").Range("A1").Text,
"[$-409]mmmm d, yyyy;@")
End Sub

It also will not update all sheets.

"Tom Ogilvy" wrote:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.RightFooter = "&""Verdana""&8 " & _
Format(Activesheet.Range("A1").Value, "dd-mm-yyyy")
End Sub

Placed in the ThisWorkbook Module.

--
Regards,
Tom Ogilvy


"Judd Jones" wrote in message
...
I have a workbook with about 20 worksheets. I need to be able to

change
the
date that is typed into the header. Is there a way to reference a cell

with
the date that I want as part of my header. Any help or direction would

be
nice.






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Dates in Header

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

This code should go in the ThisWorkbook code module.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Judd Jones" wrote in message
...
I have a workbook with about 20 worksheets. I need to be able to change

the
date that is typed into the header. Is there a way to reference a cell

with
the date that I want as part of my header. Any help or direction would be
nice.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Dates in Header

I'm trying to do something in my workbook that this code is close to doing,
but not quite.
1. I'm adding new sheets and want to put the code in each new sheet. I have
code to go through the new sheets, but how do I add code to a sheet?
2. I want to put this in the Center, not left.
3. I want the Center Header to have two lines:
TECHNICIAN JOB SUMMARY
For Date Range: (SheetName!CellNumberBeginDate) to
(SheetName!CellNumberEndDate) Example: For Date Range: 09-01-06 to 09-30-06
(My dates are in this format, mm-dd-yy)

Your help would be appreciated!
And again, thank you for fixing my other problem this morning!!

David

"Bob Phillips" wrote:

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

This code should go in the ThisWorkbook code module.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Judd Jones" wrote in message
...
I have a workbook with about 20 worksheets. I need to be able to change

the
date that is typed into the header. Is there a way to reference a cell

with
the date that I want as part of my header. Any help or direction would be
nice.




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
Static dates in Header bradsdad25 Excel Discussion (Misc queries) 0 March 14th 05 04:17 PM
how do I permanetly add custom header to excel header list? GARY Excel Discussion (Misc queries) 1 December 15th 04 08:52 PM
Formatting Header and/or Footer Dates Twoo Doggs Excel Programming 1 June 18th 04 04:19 PM


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