Custom Header

K

Karen53

Hi,

I'm trying to add a custom header based on worksheet cell values, so I've
created the variable 'NewHeader'. When I run the code, the header font is
HUGE even though I've indicated 12 pt. What have I done wrong?

Sub AddNewInvoiceHeader(NewHeader, InvoiceName, ShName)

If InvoiceName = "CAM" Then
Sheets(ShName).PageSetup.PrintArea = "$E$10:$O$52"
Else
Sheets(ShName).PageSetup.PrintArea = "$S$10:$AC$52"
End If
With Sheets(ShName).PageSetup
.LeftHeader = ""
.CenterHeader = "&""Arial,Bold""&12" & NewHeader
.RightHeader = ""
.HeaderMargin = Application.InchesToPoints(0.5)
.CenterHorizontally = True
.CenterVertically = False
End With

End Sub

Here is the code assigning 'NewHeader'L

ThisYear = Left(LineItemspg.Range("E13"), 4)

If MainPagepg.Range("D6").Value = "Yes" Then
InvoiceType = "Reconciliation"
Else
InvoiceType = "Deposit"
End If

NewHeader = ThisYear & " " & InvoiceName & " Invoice " & InvoiceType
 
J

JLGWhiz

..CenterHeader = "&""Arial,Bold""&12" & NewHeader

Should be:

..CenterHeader = " &"Arial" &B &12" & NewHeader
I assume that NewHeader is a variable for the text.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top