ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Worksheet name in footer (https://www.excelbanter.com/excel-discussion-misc-queries/133036-worksheet-name-footer.html)

mike_vr

Worksheet name in footer
 
Hi all,

Relatively simple one I hope. Trying to insert a footer that automatically
updates to the name of the current worksheet. I've got &[Path] to show the
directory, &[File] to show the file name, but what would be the short way to
get the worksheet name in the footer? &[???]

Thanks in advance,

Mike

Bob Phillips

Worksheet name in footer
 
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet
.PageSetup.LeftFooter = .Name
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


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"mike_vr" wrote in message
...
Hi all,

Relatively simple one I hope. Trying to insert a footer that automatically
updates to the name of the current worksheet. I've got &[Path] to show the
directory, &[File] to show the file name, but what would be the short way
to
get the worksheet name in the footer? &[???]

Thanks in advance,

Mike




mike_vr

Worksheet name in footer
 
Hi Bob,

Thanks for that, but unfortunately not exactly what I'm after - sorry,
should have been clearer!!

I've got a macro that inserts the path, worksheet, filename. However, I've
found that the problem with this is that once it's in, it doesn't update if I
save the book as a new book or update the worksheet name. I.e. it takes a
snapshot of what the file is and inserts it as a footer, but when I save to a
new month it doesn't update unless I run the macro again.

I have noticed though that the &[path] and &[File] methods do update when
saved as a new workbook so was hoping that there would be a similar way of
adding the worksheet name.

Any thoughts?

Thanks,

Mike

"Bob Phillips" wrote:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet
.PageSetup.LeftFooter = .Name
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


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"mike_vr" wrote in message
...
Hi all,

Relatively simple one I hope. Trying to insert a footer that automatically
updates to the name of the current worksheet. I've got &[Path] to show the
directory, &[File] to show the file name, but what would be the short way
to
get the worksheet name in the footer? &[???]

Thanks in advance,

Mike





Niek Otten

Worksheet name in footer
 
&[Tab]

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"mike_vr" wrote in message ...
| Hi Bob,
|
| Thanks for that, but unfortunately not exactly what I'm after - sorry,
| should have been clearer!!
|
| I've got a macro that inserts the path, worksheet, filename. However, I've
| found that the problem with this is that once it's in, it doesn't update if I
| save the book as a new book or update the worksheet name. I.e. it takes a
| snapshot of what the file is and inserts it as a footer, but when I save to a
| new month it doesn't update unless I run the macro again.
|
| I have noticed though that the &[path] and &[File] methods do update when
| saved as a new workbook so was hoping that there would be a similar way of
| adding the worksheet name.
|
| Any thoughts?
|
| Thanks,
|
| Mike
|
| "Bob Phillips" wrote:
|
| Private Sub Workbook_BeforePrint(Cancel As Boolean)
| With ActiveSheet
| .PageSetup.LeftFooter = .Name
| 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
|
|
| --
| HTH
|
| Bob
|
| (there's no email, no snail mail, but somewhere should be gmail in my addy)
|
| "mike_vr" wrote in message
| ...
| Hi all,
|
| Relatively simple one I hope. Trying to insert a footer that automatically
| updates to the name of the current worksheet. I've got &[Path] to show the
| directory, &[File] to show the file name, but what would be the short way
| to
| get the worksheet name in the footer? &[???]
|
| Thanks in advance,
|
| Mike
|
|
|



mike_vr

Worksheet name in footer
 
Spot on, thank you very much!!

"Niek Otten" wrote:

&[Tab]

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"mike_vr" wrote in message ...
| Hi Bob,
|
| Thanks for that, but unfortunately not exactly what I'm after - sorry,
| should have been clearer!!
|
| I've got a macro that inserts the path, worksheet, filename. However, I've
| found that the problem with this is that once it's in, it doesn't update if I
| save the book as a new book or update the worksheet name. I.e. it takes a
| snapshot of what the file is and inserts it as a footer, but when I save to a
| new month it doesn't update unless I run the macro again.
|
| I have noticed though that the &[path] and &[File] methods do update when
| saved as a new workbook so was hoping that there would be a similar way of
| adding the worksheet name.
|
| Any thoughts?
|
| Thanks,
|
| Mike
|
| "Bob Phillips" wrote:
|
| Private Sub Workbook_BeforePrint(Cancel As Boolean)
| With ActiveSheet
| .PageSetup.LeftFooter = .Name
| 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
|
|
| --
| HTH
|
| Bob
|
| (there's no email, no snail mail, but somewhere should be gmail in my addy)
|
| "mike_vr" wrote in message
| ...
| Hi all,
|
| Relatively simple one I hope. Trying to insert a footer that automatically
| updates to the name of the current worksheet. I've got &[Path] to show the
| directory, &[File] to show the file name, but what would be the short way
| to
| get the worksheet name in the footer? &[???]
|
| Thanks in advance,
|
| Mike
|
|
|





All times are GMT +1. The time now is 06:25 AM.

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