PDA

View Full Version : Solved: Formatting headers



lilstevie
01-18-2007, 08:49 AM
Any help or guidance would be greatly appreciated

I am using the following to place the contents of a cell as the header on a sheet. I would like to adjust the font of this to BOLD, SIZE 14, And underlined.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.RightHeader = Range("BJ1").Value
End Sub

VBA help ("header formatting codes for headers") lists the codes to apply these settings. (&B - bold, $U - underline, &14 -size) However I can't seem to get them incorporated into the above code correctly.

Tried &B&u&10 "range("bj1").Value"b&u&10& with no luck:think:

RichardSchollar
01-18-2007, 09:10 AM
Give this a try (worked for me when testing):



Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.RightHeader = "&""Arial,Bold""&14&U" & Range("BJ1").Value
End Sub


Richard

lilstevie
01-18-2007, 09:13 AM
Thats got it - Thank You!