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

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

Comments

  • You can do it with some VBA.
  • googler
    googler Posts: 16,103 Forumite
    Part of the Furniture 10,000 Posts Name Dropper Combo Breaker
    I googled 'insert user name excel' and this was third on the list...

    http://vbaexpress.com/kb/getarticle.php?kb_id=768
  • victor2
    victor2 Posts: 8,343 Ambassador
    Part of the Furniture 1,000 Posts Name Dropper
    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.

  • Verb
    Verb Posts: 227 Forumite
    Part of the Furniture 100 Posts Combo Breaker
    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.
  • PhilCo_2
    PhilCo_2 Posts: 136 Forumite
    You will need to make sure all users have their username filled in in Options.
  • googler
    googler Posts: 16,103 Forumite
    Part of the Furniture 10,000 Posts Name Dropper Combo Breaker
    PhilCo wrote: »
    You will need to make sure all users have their username filled in in Options.

    Doesn't this presume that each user is using their own PC?
  • Lil306
    Lil306 Posts: 1,692 Forumite
    Part of the Furniture 1,000 Posts Name Dropper Combo Breaker
    googler wrote: »
    Doesn't this presume that each user is using their own PC?

    Yup

    Those settings are stored in c:\docs settings\app data IIRC
    Owner of andrewhope.co.uk, hate cars and love them

    Working towards DFD

    HSBC Credit Card - £2700 / £7500
    AA Loans - (cleared £9700)
  • Verb wrote: »
    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.
This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

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

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.