We’d like to remind Forumites to please avoid political debate on the Forum.
This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
The Forum now has a brand new text editor, adding a bunch of handy features to use when creating posts. Read more in our how-to guide
Help With Excel
Verb
Posts: 227 Forumite
in Techie Stuff
Can anyone help please.
I currently use the following function to put a date on the sheets that get print out in work.
=TODAY()
Does anyone know of a similar function that will allow me to attach the UserName of whoever prints.
Thanks
I currently use the following function to put a date on the sheets that get print out in work.
=TODAY()
Does anyone know of a similar function that will allow me to attach the UserName of whoever prints.
Thanks
0
Comments
-
You can do it with some VBA.0
-
I googled 'insert user name excel' and this was third on the list...
http://vbaexpress.com/kb/getarticle.php?kb_id=7680 -
Not quite as easy, but a simple bit of code can do it if you are happy creating a VB "macro"...
Put this into a Visual Basic editor session within the spreadsheet:
Function GetUserName()
GetUserName = Application.UserName
End Function
Then in the spreadsheet itself, just use =GetUserName() where you want the currently logged in user's name.I’m a Forum Ambassador and I support the Forum Team on the In My Home MoneySaving, Energy and Techie Stuff boards. If you need any help on these boards, do let me know. Please note that Ambassadors are not moderators. Any posts you spot in breach of the Forum Rules should be reported via the report button, or by emailing forumteam@moneysavingexpert.com.
All views are my own and not the official line of MoneySavingExpert.
0 -
Hi all, thanks for the replys.
Look at both and tried victor2's. But when i do it all it adds to the sheet that I print is the word Name.
Can anyone add to this please.0 -
You will need to make sure all users have their username filled in in Options.0
-
Hi all, thanks for the replys.
Look at both and tried victor2's. But when i do it all it adds to the sheet that I print is the word Name.
Can anyone add to this please.
As stated, victor2's solution relies on the data being populated in Excel, which isn't reliable, so what you want to get is the logged on user. Googler's link will do thiis, however there is simpler way using the vba environ function which can be used to return the operating system Environment Variables, and one of the environemnt Variables is the Windows Username.
Function GetUserName()
GetUserName = Environ("USERNAME")
End Function
To see the other Environemnt variable you can return using this method, o to a command prompt and type SET. Any of the variables to the left of the "=" can be returned using this method by change the name in quotes.0
This discussion has been closed.
Confirm your email address to Create Threads and Reply
Categories
- All Categories
- 353.5K Banking & Borrowing
- 254.2K Reduce Debt & Boost Income
- 455K Spending & Discounts
- 246.6K Work, Benefits & Business
- 602.9K Mortgages, Homes & Bills
- 178.1K Life & Family
- 260.6K Travel & Transport
- 1.5M Hobbies & Leisure
- 16K Discuss & Feedback
- 37.7K Read-Only Boards