#1   Report Post  
Marlis
 
Posts: n/a
Default custom header

I would like to know how to set up a custom header which shows the data in a
perticular cell (i.e. - C9 shows the number 100, so I want the header in all
the pages,except the first, to show "100".

Thank you
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

One way is to use a macro.

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)

Dim myHeaderStr As String
Dim iCtr As Long

myHeaderStr = Worksheets("sheet3").Range("C9").Value

For iCtr = 2 To Worksheets.Count
Worksheets(iCtr).PageSetup.LeftHeader = myHeaderStr
Next iCtr

End Sub

(I used c9 on sheet3 (you didn't say which sheet to use).)

This code goes in the ThisWorkbook module.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Marlis wrote:

I would like to know how to set up a custom header which shows the data in a
perticular cell (i.e. - C9 shows the number 100, so I want the header in all
the pages,except the first, to show "100".

Thank you


--

Dave Peterson
  #3   Report Post  
Marlis
 
Posts: n/a
Default

I don't know what I am doing wrong. I followed the directions for copying
and pasting a macro from the site you recommended....but I can't get it to
work.

My workbook is named "book1", the sheet is named "Order form" and the cell
is "c9".

What do you suggest for getting this to work?

Thank you

"Dave Peterson" wrote:

One way is to use a macro.

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)

Dim myHeaderStr As String
Dim iCtr As Long

myHeaderStr = Worksheets("sheet3").Range("C9").Value

For iCtr = 2 To Worksheets.Count
Worksheets(iCtr).PageSetup.LeftHeader = myHeaderStr
Next iCtr

End Sub

(I used c9 on sheet3 (you didn't say which sheet to use).)

This code goes in the ThisWorkbook module.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Marlis wrote:

I would like to know how to set up a custom header which shows the data in a
perticular cell (i.e. - C9 shows the number 100, so I want the header in all
the pages,except the first, to show "100".

Thank you


--

Dave Peterson

  #4   Report Post  
Dave Peterson
 
Posts: n/a
Default

Make sure you pasted that workbook_beforeprint routine into the ThisWorkbook
module.

If you've verified that the code is there, what happens when you hit
File|PrintPreview?

And you may want to post the code you used.

Marlis wrote:

I don't know what I am doing wrong. I followed the directions for copying
and pasting a macro from the site you recommended....but I can't get it to
work.

My workbook is named "book1", the sheet is named "Order form" and the cell
is "c9".

What do you suggest for getting this to work?

Thank you

"Dave Peterson" wrote:

One way is to use a macro.

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)

Dim myHeaderStr As String
Dim iCtr As Long

myHeaderStr = Worksheets("sheet3").Range("C9").Value

For iCtr = 2 To Worksheets.Count
Worksheets(iCtr).PageSetup.LeftHeader = myHeaderStr
Next iCtr

End Sub

(I used c9 on sheet3 (you didn't say which sheet to use).)

This code goes in the ThisWorkbook module.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Marlis wrote:

I would like to know how to set up a custom header which shows the data in a
perticular cell (i.e. - C9 shows the number 100, so I want the header in all
the pages,except the first, to show "100".

Thank you


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Marlis
 
Posts: n/a
Default

I am lost as to what to do. I don't seem to understand what to do.

"Dave Peterson" wrote:

One way is to use a macro.

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)

Dim myHeaderStr As String
Dim iCtr As Long

myHeaderStr = Worksheets("sheet3").Range("C9").Value

For iCtr = 2 To Worksheets.Count
Worksheets(iCtr).PageSetup.LeftHeader = myHeaderStr
Next iCtr

End Sub

(I used c9 on sheet3 (you didn't say which sheet to use).)

This code goes in the ThisWorkbook module.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Marlis wrote:

I would like to know how to set up a custom header which shows the data in a
perticular cell (i.e. - C9 shows the number 100, so I want the header in all
the pages,except the first, to show "100".

Thank you


--

Dave Peterson



  #6   Report Post  
Dave Peterson
 
Posts: n/a
Default

Maybe posting what you tried would help get a better response.

Marlis wrote:

I am lost as to what to do. I don't seem to understand what to do.

"Dave Peterson" wrote:

One way is to use a macro.

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)

Dim myHeaderStr As String
Dim iCtr As Long

myHeaderStr = Worksheets("sheet3").Range("C9").Value

For iCtr = 2 To Worksheets.Count
Worksheets(iCtr).PageSetup.LeftHeader = myHeaderStr
Next iCtr

End Sub

(I used c9 on sheet3 (you didn't say which sheet to use).)

This code goes in the ThisWorkbook module.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Marlis wrote:

I would like to know how to set up a custom header which shows the data in a
perticular cell (i.e. - C9 shows the number 100, so I want the header in all
the pages,except the first, to show "100".

Thank you


--

Dave Peterson


--

Dave Peterson
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
Custom List Header GeyserPeak Excel Discussion (Misc queries) 2 July 8th 05 04:27 PM
How to set a custom header as a row from the spreadsheet? ruthie Excel Discussion (Misc queries) 2 April 21st 05 06:48 AM
Custom Header and Footer Dave Excel Discussion (Misc queries) 1 March 23rd 05 08:24 PM
how do I permanetly add custom header to excel header list? GARY Excel Discussion (Misc queries) 1 December 15th 04 08:52 PM
Custom Header Josh O. Excel Discussion (Misc queries) 1 December 1st 04 06:56 PM


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