Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default set header font size using a variable?

I am trying to set the header font size to a variable (I just am using a
constant in this example), but am having no luck getting it to print. I have
tried many attempts but am not getting what I need. So far I get no header
or some other formatting (time, strikethrough, etc). Please help. Thanks in
advance.

FS = 36

..CenterHeader = "&""Times New Roman,Bold" & FS & "ATTACHMENT I"
does not work

..CenterHeader = "&""Times New Roman,Bold""&FSATTACHMENT I"
does not work either
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default set header font size using a variable?

If you record a macro you get:

..CenterHeader = "&""Times New Roman,Regular""&36ATTACHMENT I"

so to replace the 36 you need

..CenterHeader = "&""Times New Roman,Regular""&" & FS & "ATTACHMENT I"

the first ampersand after ",Regular" is part of the string, the second is
the concatenation operator

--
Regards,
Tom Ogilvy


"Seth" wrote in message
...
I am trying to set the header font size to a variable (I just am using a
constant in this example), but am having no luck getting it to print. I

have
tried many attempts but am not getting what I need. So far I get no

header
or some other formatting (time, strikethrough, etc). Please help. Thanks

in
advance.

FS = 36

.CenterHeader = "&""Times New Roman,Bold" & FS & "ATTACHMENT I"
does not work

.CenterHeader = "&""Times New Roman,Bold""&FSATTACHMENT I"
does not work either



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default set header font size using a variable?


Because it is treating the &'s as part of the string...

You should change it like so...
CenterHeader = "&" & chr(34) & "Times New Roman,Bold&"&chr(34)&" & FS &
"&ATTACHMENT I"

(The Chr(34) returns the double quote to make it easier to read


--
kraljb
------------------------------------------------------------------------
kraljb's Profile: http://www.excelforum.com/member.php...fo&userid=9955
View this thread: http://www.excelforum.com/showthread...hreadid=400911

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default set header font size using a variable?

Great! It works now as intended. Thanks a bunch!

"Tom Ogilvy" wrote:

If you record a macro you get:

..CenterHeader = "&""Times New Roman,Regular""&36ATTACHMENT I"

so to replace the 36 you need

..CenterHeader = "&""Times New Roman,Regular""&" & FS & "ATTACHMENT I"

the first ampersand after ",Regular" is part of the string, the second is
the concatenation operator

--
Regards,
Tom Ogilvy


"Seth" wrote in message
...
I am trying to set the header font size to a variable (I just am using a
constant in this example), but am having no luck getting it to print. I

have
tried many attempts but am not getting what I need. So far I get no

header
or some other formatting (time, strikethrough, etc). Please help. Thanks

in
advance.

FS = 36

.CenterHeader = "&""Times New Roman,Bold" & FS & "ATTACHMENT I"
does not work

.CenterHeader = "&""Times New Roman,Bold""&FSATTACHMENT I"
does not work either




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing Font color based on font type or size John Excel Discussion (Misc queries) 2 February 7th 08 12:50 AM
Change all text one font size up with various font sizes used. omchrystal New Users to Excel 2 March 6th 07 09:01 PM
Header Font size Mike Fogleman Excel Programming 3 June 22nd 05 01:12 AM
Dropdown list for font size, font type and number formats ExcelMonkey[_190_] Excel Programming 1 March 9th 05 03:50 PM
Change Header Font Size Bret Excel Programming 2 October 27th 04 04:19 PM


All times are GMT +1. The time now is 04:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"