View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default coding help for headers

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.