excel noob, inputting my user name into a cell

Associate
Joined
6 Jan 2006
Posts
785
Location
Ayy
Am looking to have a command button on my spreadsheet that inputs my windows logon/outlook name into a specfied cell, does anyone know how I would go about this?

Thanks
 
Associate
OP
Joined
6 Jan 2006
Posts
785
Location
Ayy
Thanks for reply, I've tried that and similar methods, but whenever I try to declare the function in a cell I.e =username() the cell juts shows #NAME?

Any idea what might be causing this?
 
Associate
Joined
20 Mar 2009
Posts
162
Location
Leeds
Go to your spreadsheet's code, insert a new module (don't add to the sheets or ThisWorkbook) via the menu, paste the function in the new module's "(General)" section -

Code:
Function UserNameWindows() As String
    UserNameWindows = Environ("USERNAME")
End Function

.. then use "=UserNameWindows()" in a cell.
 
Associate
OP
Joined
6 Jan 2006
Posts
785
Location
Ayy
Thanks for all the input,managed to get this working. Another issue I've got, does anyone know how I would pull the header information from a web page to a specific cell in excel?
 
Back
Top Bottom