Consulting

Results 1 to 3 of 3

Thread: Solved: Formatting headers

  1. #1

    Solved: Formatting headers

    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.

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

    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

  2. #2
    VBAX Contributor
    Joined
    Aug 2006
    Location
    Hampshire, UK
    Posts
    140
    Location
    Give this a try (worked for me when testing):

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

    Richard

  3. #3
    Thats got it - Thank You!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •