Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sub Workbook Open()

Status
Not open for further replies.

mllex

Technical User
Nov 28, 2001
44
US

I have the following code in Sub Workbook Open()

Worksheets("Name of Sheet").Activate
ActiveSheet.PageSetup.RightFooter = Application.UserName

In the event the user changes the name of the worksheet, how can I be sure the username gets into the footnote?

I need generic code, not specific to a particular workbook or worksheet.

Can anyone offer an alternative?
 
If you want to do this to the active worksheet, you do not need the Worksheets("Name of Sheet").Activate line.
 
If you want to do this to each sheet in the workbook:
Code:
    Dim ws As Worksheet
    For Each ws In ActiveWorkbook.Sheets
        ws.PageSetup.RightFooter = Application.UserName
    Next ws
[code]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top