Forum Discussion
mschonefeld
May 19, 2021Copper Contributor
Auto Populate Header Using Another Sheet
For years I have been struggling with a document that I change several times a month, and know there is an easier way to solve this issue. It seems like auto populating a header should be easy to do,...
- May 19, 2021
This requires VBA. For example in the Worksheet_Activate event:
- Right-click the sheet tab of sheet B.
- Select 'View Code' from the context menu.
- Copy the code listed below into the worksheet module.
- Switch back to Excel and save the workbook.
- The header will be updated when you activate sheet B.
Private Sub Worksheet_Activate() Me.PageSetup.CenterHeader = _ "&""Arial""&14&B" & _ Worksheets("A").Range("H6").Value & vbLf & _ "PO #" & Worksheets("A").Range("C6").Value & vbLf & vbLf & _ "PRELIMINARY" & vbLf & vbLf & _ "COLOR SAMPLE REQUEST" End Sub
mschonefeld
May 20, 2021Copper Contributor
I would like to be able to add the Date and Time printed in the RightFooter, but keep getting script errors when I alter hans_Vogelaar's script to include this. Also I would like to include a line just above the print date/time that includes "CC"Field, Job# " and then pulls data from H6.
Any help would be greatly appreciated.
Thanks again.
Any help would be greatly appreciated.
Thanks again.
HansVogelaar
May 21, 2021MVP
I'm slightly confused by that, but see the attached version.