Ahhhh.
There's a bug in the code.
It keeps appending the stuff in A1:A4 to the same headerstr variable.
It should be reset to "" for each worksheet:
Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim Cell As Range
Dim HeaderStr As String
Dim mySheetNames As Variant
Dim iCtr As Long
mySheetNames = Array("IS-LA", "BS-LA", "BS-LA-CV")
For iCtr = LBound(mySheetNames) To UBound(mySheetNames)
headerstr = "" '<---- added
With Worksheets(mySheetNames(iCtr))
'do your stuff
For Each Cell In .Range("a1:a4")
HeaderStr = HeaderStr & Cell.Value & vbCr
Next Cell
'Remove last vbCr
HeaderStr = Left(HeaderStr, Len(HeaderStr) - 1)
.PageSetup.CenterHeader = HeaderStr
End With
Next iCtr
End Sub
And I find it better to adjust the headers for all the sheets that need them.
There's nothing in this event (workbook_beforeprint) that tells you what sheet
(or sheets) is being printed.
And if you record a macro when you set the font, you should see the code
necessary to change the size.
You can initialize that headerstr with that code:
headerstr = "whateveryougetfromyourrecordedmacro"
You'll have to do a little work to get it going.
Indeed, it looks like the headings may be too long after all, but that seems
to be happening because each time the macro is invoked, it adds yet another
heading to the one it established the last time the macro was run (it may
max out at twice). Also, the headings that are already there seem to be
from cell a1:a4 of only the first sheet. I guess this is somewhat
consistent with what you're telling me about what the macro is doing.
Back to the original intent. I wanted it to only do this for only the
active sheet I am on, when I hit the print icon. Kindly edit the macro as
needed.
Lastly, back when I added the macro, I had some huge font sizes and a small,
e.g. 25% EXCEL resolution. I don't know if this is why but the headings
printed via this macro are microscopic, something I don't want. Can you
edit the macro to make them bigger?
Thanks again, Dave!
Dean