Custom Header/Footers

eibcga

New Member
Joined
Dec 7, 2005
Messages
10
The following code will place the full file name, including the path, into the header of the active worksheet.

ActiveSheet.PageSetup.LeftHeader = ThisWorkbook.FullName


Question:
How do I include the Sheet Name with the filemame as well?

Thanks
 

Some videos you may like

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Datsmart

Well-known Member
Joined
Jun 19, 2003
Messages
7,985
= ActiveCell.Parent.Name
Gives you the Sheet Name.

= ActiveWorkbook.Name
Gives you just the workbook name.
 

eibcga

New Member
Joined
Dec 7, 2005
Messages
10
Thank you. So how do I string this syntax all together so it will show the [path][filename][sheet] ?
 

Datsmart

Well-known Member
Joined
Jun 19, 2003
Messages
7,985
Untried:

ActiveSheet.PageSetup.LeftHeader = ThisWorkbook.FullName & " " & ActiveCell.Parent.Name & " " & ActiveWorkbook.Name
All on one line.
 

Watch MrExcel Video

Forum statistics

Threads
1,118,820
Messages
5,574,511
Members
412,599
Latest member
Schu94
Top