PDA

View Full Version : How to display Variable in xl custom header



Brew4chuck
03-13-2008, 08:14 AM
I am new to VBA and am trying to display the value of a variable (string format) in a custom excel header. The string variable is a month and I would like it to appear in the header. So far I've had no success.

Bob Phillips
03-13-2008, 08:27 AM
Off the tops



Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet.PageSetup

.LeftHeader = myvar
End With
End Sub


This is workbook event code.
To input this code, right click on the Excel icon on the worksheet
(or next to the File menu if you maximise your workbooks),
select View Code from the menu, and paste the code

Brew4chuck
03-13-2008, 06:35 PM
Thanks for the help. It makes sense now that I see it.

Brew4Chuck