Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Ronnyk
 
Posts: n/a
Default what code pulls in contents of a cell in an Excel header/footer?

I want to put a code in a header/footer to pull in the contents of cell a1.
I thought it was \A1, but this doesn't work, and I can't find any reference
to how to do this.
  #2   Report Post  
Earl Kiosterud
 
Posts: n/a
Default

Ronny,

To my knowledge, there's no code. But you can paste this into the
ThisWorkbook module:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Sheets("Sheet1").PageSetup.CenterHeader = Sheets("Sheet1").Range("A1").Value
End Sub

To do that, get into the VBE (Alt - F11). Double-click the ThisWorkbook
item in the Project manager, which should open a window for the code behind
the workbook. Then paste the code in from here.

It will set the page header to the contents of A1 before you do a print or
print preview.
--
Earl Kiosterud
www.smokeylake.com

"Ronnyk" wrote in message
...
I want to put a code in a header/footer to pull in the contents of cell a1.
I thought it was \A1, but this doesn't work, and I can't find any
reference
to how to do this.



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15
Default what code pulls in contents of a cell in an Excel header/foote

I have a similar issue and I used this VBA code and it worked. However, I
have nineteen different worksheets w/charts on each which I would like to
have the info from a cell placed as the header when each worksheet is
printed. How do I modify this code to accomplish this?

"Earl Kiosterud" wrote:

Ronny,

To my knowledge, there's no code. But you can paste this into the
ThisWorkbook module:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Sheets("Sheet1").PageSetup.CenterHeader = Sheets("Sheet1").Range("A1").Value
End Sub

To do that, get into the VBE (Alt - F11). Double-click the ThisWorkbook
item in the Project manager, which should open a window for the code behind
the workbook. Then paste the code in from here.

It will set the page header to the contents of A1 before you do a print or
print preview.
--
Earl Kiosterud
www.smokeylake.com

"Ronnyk" wrote in message
...
I want to put a code in a header/footer to pull in the contents of cell a1.
I thought it was \A1, but this doesn't work, and I can't find any
reference
to how to do this.




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default what code pulls in contents of a cell in an Excel header/foote


Dim ws As Worksheet
For Each ws In ActiveWorkbook.Sheets
'or For Each ws in ActiveWindow.SelectedSheets
ws.PageSetup.CenterHeader = ws.Range("A1").Value
Next


Gord Dibben MS Excel MVP

On Thu, 13 Sep 2007 12:00:03 -0700, quattda
wrote:

I have a similar issue and I used this VBA code and it worked. However, I
have nineteen different worksheets w/charts on each which I would like to
have the info from a cell placed as the header when each worksheet is
printed. How do I modify this code to accomplish this?

"Earl Kiosterud" wrote:

Ronny,

To my knowledge, there's no code. But you can paste this into the
ThisWorkbook module:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Sheets("Sheet1").PageSetup.CenterHeader = Sheets("Sheet1").Range("A1").Value
End Sub

To do that, get into the VBE (Alt - F11). Double-click the ThisWorkbook
item in the Project manager, which should open a window for the code behind
the workbook. Then paste the code in from here.

It will set the page header to the contents of A1 before you do a print or
print preview.
--
Earl Kiosterud
www.smokeylake.com

"Ronnyk" wrote in message
...
I want to put a code in a header/footer to pull in the contents of cell a1.
I thought it was \A1, but this doesn't work, and I can't find any
reference
to how to do this.





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 other workbooks.. DavidMunday Excel Worksheet Functions 2 July 1st 05 07:35 AM
Pasting Word table cell with paragraph markers into single Excel c Steve Excel Discussion (Misc queries) 1 June 16th 05 11:26 PM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


All times are GMT +1. The time now is 12:02 AM.

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"