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.
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.
Off the tops
[vba]
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet.PageSetup
.LeftHeader = myvar
End With
End Sub
[/vba]
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
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
Thanks for the help. It makes sense now that I see it.
Brew4Chuck