Welcome to the Excel Forum

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.

Please Register to Remove these Ads

Please Register to Remove these Ads



Reply
  #1  
Old 07-04-2009, 12:39 PM
RPOD RPOD is offline
Registered User
 
Join Date: 12 Apr 2008
Posts: 24
RPOD is becoming part of the community
Formatting center header

Please Register to Remove these Ads

Hi all,
I'm trying to find some code that will format the center header to Arial Bold, size 14.
Currently I have the center header populated with the cell value E9 using -

ActiveSheet.PageSetup.CenterHeader = Range("E9").Value

I've been digging around on the internet, but can't figure out how to format the text automatically.

Thanks in advance!

Last edited by RPOD; 07-04-2009 at 01:18 PM.
Reply With Quote
  #2  
Old 07-04-2009, 01:02 PM
Leith Ross's Avatar
Leith Ross Leith Ross is offline
Forum Moderator
 
Join Date: 15 Jan 2005
Location: San Francisco, Ca
MS Office Version:2000, 2003, & read 2007
Posts: 10,537
Leith Ross Has a higher level of understanding Leith Ross Has a higher level of understanding Leith Ross Has a higher level of understanding Leith Ross Has a higher level of understanding Leith Ross Has a higher level of understanding Leith Ross Has a higher level of understanding Leith Ross Has a higher level of understanding Leith Ross Has a higher level of understanding
Send a message via AIM to Leith Ross
Re: Formatting center header

Hello RPOD,

Here is the code...
Code:
ActiveSheet.PageSetup.CenterHeader = "&""Arial""&14 " & Range("E9")
__________________
Sincerely,
Leith Ross

Remember To Do the Following....

1. Use code tags. Place [code] before the first line of code and [/code] after the last line of code.
2. Thank those who have helped you by Clicking the scales above each post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.


Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
Reply With Quote
  #3  
Old 07-04-2009, 01:05 PM
shg's Avatar
shg shg is offline
Forum Guru
 
Join Date: 20 Jun 2007
Location: The Great State of Texas
MS Office Version:2003, 2007
Posts: 18,530
shg makes giving solutions look like childsplay shg makes giving solutions look like childsplay shg makes giving solutions look like childsplay shg makes giving solutions look like childsplay shg makes giving solutions look like childsplay shg makes giving solutions look like childsplay shg makes giving solutions look like childsplay shg makes giving solutions look like childsplay shg makes giving solutions look like childsplay shg makes giving solutions look like childsplay
Re: Formatting center header

One of those cases where recording a macro shows the way:
Code:
Sub Macro1()
    With ActiveSheet.PageSetup
        .LeftHeader = ""
        .CenterHeader = "&""Arial,Bold""&14Bob" ' I entered "Bob" manually
        .RightHeader = ""
        .LeftFooter = ""
        .CenterFooter = ""
        .RightFooter = ""
        .LeftMargin = Application.InchesToPoints(0.75)
        .RightMargin = Application.InchesToPoints(0.75)
        .TopMargin = Application.InchesToPoints(1)
        .BottomMargin = Application.InchesToPoints(1)
        .HeaderMargin = Application.InchesToPoints(0.5)
        .FooterMargin = Application.InchesToPoints(0.5)
        .PrintHeadings = False
        .PrintGridlines = False
        .PrintComments = xlPrintNoComments
        .PrintQuality = 1200
        .CenterHorizontally = False
        .CenterVertically = False
End Sub
Then change to:
Code:
    ActiveSheet.PageSetup.CenterHeader = "&""Arial,Bold""&14" & Range("E9").Text
__________________
Entia non sunt multiplicanda sine necessitate.
Reply With Quote
  #4  
Old 07-04-2009, 01:17 PM
RPOD RPOD is offline
Registered User
 
Join Date: 12 Apr 2008
Posts: 24
RPOD is becoming part of the community
Re: Formatting center header

Thanks for the help - This forum is awesome!
Reply With Quote


Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump