Home |
Search |
Today's Posts |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
coding help for headers
hi Dixie
Your first worksheet have index 1 and the second = 2 and the ...... If ActiveSheet.Index 7 Then This will only run the code if the activesheet is in position 8 or higher. Have you delete the header in all sheets first before you start testing ? -- Regards Ron de Bruin http://www.rondebruin.nl "Dixie Folzenlogen" wrote in message ... Thanks Ron. Forgive my ignorance but what is the sheet index? I have combined several workbooks and even tho one of my worksheets is in "position 1" in the current workbook, it must have retained it's old "index" because the header is still showing up. Suggestions? "Ron de Bruin" wrote: One way is to test the sheet index Private Sub Workbook_BeforePrint(Cancel As Boolean) If ActiveSheet.Index 7 Then With ActiveSheet.PageSetup .CenterHeader = _ "&""Arial,Bold""Statement of Investment Advisory Services" _ & Chr(10) & "prepared for " & Chr(10) & "&14" & ActiveSheet.Range("A1").Value _ & "&10" & Chr(10) & "for the three month period from " & Chr(10) _ & ActiveSheet.Range("B2").Value & Chr(10) & Chr(10) End With End If End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Dixie Folzenlogen" <Dixie wrote in message ... I'm not a programmer but have occasionally been able to "piece together" some VB code using this forum which has been very helpful. Here's what I'm trying to do: I want to generate page headers on multiple worksheets in one workbook which pull in information using cell references. I do not want to have this particular header for ALL my worksheets. Specifically, the first 7 worksheets should not have a header and the balance should. Using this forum, I put this in this code: Private Sub Workbook_BeforePrint(Cancel As Boolean) With ActiveSheet.PageSetup .CenterHeader = _ "&""Arial,Bold""Statement of Investment Advisory Services" _ & Chr(10) & "prepared for " & Chr(10) & "&14" & ActiveSheet.Range("A1").Value _ & "&10" & Chr(10) & "for the three month period from " & Chr(10) _ & ActiveSheet.Range("B2").Value & Chr(10) & Chr(10) End With End Sub Unfortunately, this is applied against all worksheets. Can someone tell me what I am doing wrong? I would certainly appreciate any help. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
lookup using column headers and row headers | Excel Discussion (Misc queries) | |||
Macro to insert headers..need coding help | Excel Programming | |||
"=ROW()-1" type of coding doesn't appear in a filter / is there coding that does? | Excel Programming | |||
Implant macro coding into ASP coding | Excel Programming | |||
Could someone help me with some coding | Excel Programming |