View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
What-A-Tool What-A-Tool is offline
external usenet poster
 
Posts: 14
Default Macro geneated headers not displaying some sheets

Sorry - lost my original post _

Have a macro that creates a workbook, copies som sheets from various other
books, then loops thru all sheets, creating a header fro each.
For some unknown reason, my header is only appearing in about half of my
sheets, even tough my procedure is hitting and running the following code
for each sheet in my book,
I have run this code on other books and it seems to work.

This is the latest version of the several slight variations of code that I
have tried to run.

Any one PLEASE PLEASE have any possible ideas as to what my problem is ?

Thanks in advance for any help - SeanMc

Public Sub HeaderSet()
Dim sht As Worksheet

For Each sht In Workbooks(s_Author & ".xls").Sheets
If sht.Type = xlWorksheet Then
sht.Activate
MsgBox ActiveSheet.Name
ActiveSheet.PageSetup.LeftHeader = _
"Page No. " & "&P" & " of &N"
ActiveSheet.PageSetup.CenterHeader = _
s_Author & Chr(10) & "&F" & Chr(10) & "&A"
ActiveSheet.PageSetup.RightHeader = "&D"
End If
Next sht

End Sub