Header and footer, for individual machine?

joe_0_1

New Member
Joined
Mar 18, 2008
Messages
23
Hi Guys

I am looking to create a file, and each employee will use it (Timesheet)

In the footer, I would like to put in the log on to their individual machine?

I know you can put in [Date] [Time] etc etc

But would like their user name (Eg Joe, Bill, Fred) etc etc

Any ideas?
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Right click the Excel logo just to the left of File on the menu bar, select View Code and paste in

Code:
Private Sub Workbook_Open()
Sheets("Sheet1").PageSetup.LeftFooter = Environ("username")
End Sub

Change Sheet1 to suit. Save, close and reopen the file.
 
Upvote 0

joe_0_1

New Member
Joined
Mar 18, 2008
Messages
23
What a guy you are, how can I do it for every sheet on there?

(04.07.08 .... 11.07.08 ....18.07.08 .......25.07.08)

Thanks :)

also... it doesn't seem to be working for other people's machines! ?:(
 
Last edited:
Upvote 0

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try this

Code:
Private Sub Workbook_Open()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
    ws.PageSetup.LeftFooter = Environ("username")
Next ws
End Sub
 
Upvote 0

joe_0_1

New Member
Joined
Mar 18, 2008
Messages
23
Thanks, got it on all pages, but won't work on other peoples machines, just brings up my name, and I can't be bothered to do it on 30 machines! :)
 
Upvote 0

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
This isn't clear to me. Do they all have individual copies of the workbook or is it a shared file on a server or similar?
 
Upvote 0

joe_0_1

New Member
Joined
Mar 18, 2008
Messages
23
This isn't clear to me. Do they all have individual copies of the workbook or is it a shared file on a server or similar?

Sorry.

I have made a template of a timesheet.

I then copy&paste this into 30 different files. So everybody has their own copy.

So Mr a has a file for timesheets, and the individual file will be July2008 Mr a

HTH
 
Upvote 0

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
If they each have a copy of the file (including the code) then I can't understand why it isn't working, and certainly not why it would insert your username when run from another machine.

Try manually removing the footers from the workbook on another machine then saving, closing and reopening the file.
 
Upvote 0

Forum statistics

Threads
1,191,119
Messages
5,984,758
Members
439,909
Latest member
daigoku

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top