![]() |
Header properties in code
Hi,
I have modified some code written by Chip Pearson. The code works perfectly. Basically the code takes the content of a cell and places it in the header. I need to add additional code to bold the header. I am calling the sub with the Workbook_BeforePrint event. Sub PrintHeader() ActiveSheet.PageSetup.CenterHeader = _ "Action Item List" & " " & vbCrLf & Format(Worksheets("Action List").Range("A2").Value) End Sub TIA |
Header properties in code
I recorded a macro when I bolded a header and got this:
..CenterHeader = "&""Arial,Bold""asdf" If you want Arial Bold, then maybe: .CenterHeader = "&""Arial,Bold""Action Item List" _ & " " & vbCrLf & _ Format(Worksheets("Action List").Range("A2").Value) If you want a different font, I'd record the macro when I did it manually. Ray A wrote: Hi, I have modified some code written by Chip Pearson. The code works perfectly. Basically the code takes the content of a cell and places it in the header. I need to add additional code to bold the header. I am calling the sub with the Workbook_BeforePrint event. Sub PrintHeader() ActiveSheet.PageSetup.CenterHeader = _ "Action Item List" & " " & vbCrLf & Format(Worksheets("Action List").Range("A2").Value) End Sub TIA -- Dave Peterson |
Header properties in code
Many Thanks Dave. Code works fine. You and the other answer people never get
enough credit. Glad to have you as a resource. Ray "Dave Peterson" wrote: I recorded a macro when I bolded a header and got this: ..CenterHeader = "&""Arial,Bold""asdf" If you want Arial Bold, then maybe: .CenterHeader = "&""Arial,Bold""Action Item List" _ & " " & vbCrLf & _ Format(Worksheets("Action List").Range("A2").Value) If you want a different font, I'd record the macro when I did it manually. Ray A wrote: Hi, I have modified some code written by Chip Pearson. The code works perfectly. Basically the code takes the content of a cell and places it in the header. I need to add additional code to bold the header. I am calling the sub with the Workbook_BeforePrint event. Sub PrintHeader() ActiveSheet.PageSetup.CenterHeader = _ "Action Item List" & " " & vbCrLf & Format(Worksheets("Action List").Range("A2").Value) End Sub TIA -- Dave Peterson |
All times are GMT +1. The time now is 10:30 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com