Username Lookup

sandwhale

New Member
Joined
Jan 27, 2023
Messages
5
Office Version
  1. 2021
Platform
  1. Windows
Hi,

So, the scenario that I have is that I'm looking to create a report within Excel so that individual staff members within my organisation can access the file and see their own data (time sheet and utilisation metrics, stuff like that). To that end, I've found some code that will allow a function to report on the individual's username when they log into the sheet, that being:

Public Function UserName()
UserName = Environ$("UserName")
End Function

At the moment, I've just got the function set up in cell A1 that updates when someone opens and enables the sheet.

However, I've a worry that in practice, that if one individual uses and saves the sheet, if someone else accesses sheet right after and doesnt enable content, the function wont have updated to this new user's ID and so the metrics being shown will remain as the first individuals.

Is there a way to remove this possible issue from occurring? Just to give a warning, I'm not the worst with Excel but I've limited knowledge of coding, so dumbed down explanations would be really welcome.

Thanks a lot

Chris
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Oh, and unless it wasn't all that clear, the user ID will be used to look up their individual data
 
Upvote 0

Forum statistics

Threads
1,223,912
Messages
6,175,340
Members
452,638
Latest member
Oluwabukunmi

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
Back
Top