Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
joeeng
 
Posts: n/a
Default Insert cell contents into header/footer

I would like to know how to insert the contents of a particular cell (in each
worksheet) into the header/footer for the corresponding worksheet.
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

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

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob Phillips

"joeeng" wrote in message
...
I would like to know how to insert the contents of a particular cell (in

each
worksheet) into the header/footer for the corresponding worksheet.



  #3   Report Post  
joeeng
 
Posts: n/a
Default

I would like this routine to work for all worksheets in the workbook when the
"print entire workbook" selection is made. The routine below only does the
first worksheet footer when I print the entire workbook.

"Bob Phillips" wrote:

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

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob Phillips

"joeeng" wrote in message
...
I would like to know how to insert the contents of a particular cell (in

each
worksheet) into the header/footer for the corresponding worksheet.




  #4   Report Post  
Ron de Bruin
 
Posts: n/a
Default

You can loop through the sheets

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
For Each wkSht In ThisWorkbook.Worksheets
wkSht.PageSetup.LeftFooter = wkSht.Range("A1").Value
Next wkSht
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"joeeng" wrote in message ...
I would like this routine to work for all worksheets in the workbook when the
"print entire workbook" selection is made. The routine below only does the
first worksheet footer when I print the entire workbook.

"Bob Phillips" wrote:

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

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob Phillips

"joeeng" wrote in message
...
I would like to know how to insert the contents of a particular cell (in

each
worksheet) into the header/footer for the corresponding worksheet.






  #5   Report Post  
joeeng
 
Posts: n/a
Default

Thanks, that works.

"Ron de Bruin" wrote:

You can loop through the sheets

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
For Each wkSht In ThisWorkbook.Worksheets
wkSht.PageSetup.LeftFooter = wkSht.Range("A1").Value
Next wkSht
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"joeeng" wrote in message ...
I would like this routine to work for all worksheets in the workbook when the
"print entire workbook" selection is made. The routine below only does the
first worksheet footer when I print the entire workbook.

"Bob Phillips" wrote:

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

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob Phillips

"joeeng" wrote in message
...
I would like to know how to insert the contents of a particular cell (in
each
worksheet) into the header/footer for the corresponding worksheet.








  #6   Report Post  
joeeng
 
Posts: n/a
Default

Can I change the font characteristics in this routine?

"Ron de Bruin" wrote:

You can loop through the sheets

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
For Each wkSht In ThisWorkbook.Worksheets
wkSht.PageSetup.LeftFooter = wkSht.Range("A1").Value
Next wkSht
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"joeeng" wrote in message ...
I would like this routine to work for all worksheets in the workbook when the
"print entire workbook" selection is made. The routine below only does the
first worksheet footer when I print the entire workbook.

"Bob Phillips" wrote:

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

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob Phillips

"joeeng" wrote in message
...
I would like to know how to insert the contents of a particular cell (in
each
worksheet) into the header/footer for the corresponding worksheet.






  #7   Report Post  
Ron de Bruin
 
Posts: n/a
Default

Yes

See how I use the font size here
http://www.rondebruin.nl/print.htm#Saved

Check out the VBA help for all formatting codes.
Look for "Formatting Codes for Headers and Footers"

You can use something like this :

.CenterFooter = "&8Page &P & of &N"
.RightFooter = "&8Last Saved : &B" & ActiveWorkbook.BuiltinDocumentProperties("Last Save Time")
.LeftFooter = "&8" & ActiveWorkbook.FullName & Chr(10) & "Sheetname : &B" & ActiveSheet.Name




--
Regards Ron de Bruin
http://www.rondebruin.nl


"joeeng" wrote in message ...
Can I change the font characteristics in this routine?

"Ron de Bruin" wrote:

You can loop through the sheets

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
For Each wkSht In ThisWorkbook.Worksheets
wkSht.PageSetup.LeftFooter = wkSht.Range("A1").Value
Next wkSht
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"joeeng" wrote in message ...
I would like this routine to work for all worksheets in the workbook when the
"print entire workbook" selection is made. The routine below only does the
first worksheet footer when I print the entire workbook.

"Bob Phillips" wrote:

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

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob Phillips

"joeeng" wrote in message
...
I would like to know how to insert the contents of a particular cell (in
each
worksheet) into the header/footer for the corresponding worksheet.








  #8   Report Post  
joeeng
 
Posts: n/a
Default

Thanks, that worked.

"Ron de Bruin" wrote:

Yes

See how I use the font size here
http://www.rondebruin.nl/print.htm#Saved

Check out the VBA help for all formatting codes.
Look for "Formatting Codes for Headers and Footers"

You can use something like this :

.CenterFooter = "&8Page &P & of &N"
.RightFooter = "&8Last Saved : &B" & ActiveWorkbook.BuiltinDocumentProperties("Last Save Time")
.LeftFooter = "&8" & ActiveWorkbook.FullName & Chr(10) & "Sheetname : &B" & ActiveSheet.Name




--
Regards Ron de Bruin
http://www.rondebruin.nl


"joeeng" wrote in message ...
Can I change the font characteristics in this routine?

"Ron de Bruin" wrote:

You can loop through the sheets

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
For Each wkSht In ThisWorkbook.Worksheets
wkSht.PageSetup.LeftFooter = wkSht.Range("A1").Value
Next wkSht
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"joeeng" wrote in message ...
I would like this routine to work for all worksheets in the workbook when the
"print entire workbook" selection is made. The routine below only does the
first worksheet footer when I print the entire workbook.

"Bob Phillips" wrote:

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

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob Phillips

"joeeng" wrote in message
...
I would like to know how to insert the contents of a particular cell (in
each
worksheet) into the header/footer for the corresponding 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
Using contents of a cell in a formula Mike Excel Discussion (Misc queries) 4 June 9th 05 03:10 AM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM
hide cell contents and make it reappear (Excel) Dave Excel Discussion (Misc queries) 3 April 15th 05 09:00 PM
Challenging Charting C TO Charts and Charting in Excel 0 January 17th 05 06:57 PM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


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