Home |
Search |
Today's Posts |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Custom List Header | Excel Discussion (Misc queries) | |||
How to set a custom header as a row from the spreadsheet? | Excel Discussion (Misc queries) | |||
Custom Header and Footer | Excel Discussion (Misc queries) | |||
how do I permanetly add custom header to excel header list? | Excel Discussion (Misc queries) | |||
Custom Header | Excel Discussion (Misc queries) |