ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Code to Print a Variable as part of CenterHeader Problem (https://www.excelbanter.com/excel-programming/321987-vba-code-print-variable-part-centerheader-problem.html)

gvlral

VBA Code to Print a Variable as part of CenterHeader Problem
 
Under PageSetup

..CenterHeader = "&""Arial,Bold""&12CW" + CalWk

I am getting a Type Mismatch when running this line of code.

A earlier line of code,
CalWk = Range("B1").Value
picks up the calendar week number from the worksheet.
When the line tries to run CalWk = 3

Any Help would be appreciated,




Tom Ogilvy

VBA Code to Print a Variable as part of CenterHeader Problem
 
"&""Arial,Bold""&12CW" & CalWk

use ampersand instead of +

--
Regards,
Tom Ogilvy


"gvlral" wrote in message
...
Under PageSetup

.CenterHeader = "&""Arial,Bold""&12CW" + CalWk

I am getting a Type Mismatch when running this line of code.

A earlier line of code,
CalWk = Range("B1").Value
picks up the calendar week number from the worksheet.
When the line tries to run CalWk = 3

Any Help would be appreciated,






Bob Phillips[_6_]

VBA Code to Print a Variable as part of CenterHeader Problem
 
Try

..CenterHeader = "&""Arial,Bold""&12CW" & CalWk

--

HTH

RP
(remove nothere from the email address if mailing direct)


"gvlral" wrote in message
...
Under PageSetup

.CenterHeader = "&""Arial,Bold""&12CW" + CalWk

I am getting a Type Mismatch when running this line of code.

A earlier line of code,
CalWk = Range("B1").Value
picks up the calendar week number from the worksheet.
When the line tries to run CalWk = 3

Any Help would be appreciated,







All times are GMT +1. The time now is 01:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com