Can formulas have the Windows Username in them?

RockandGrohl

Well-known Member
Joined
Aug 1, 2018
Messages
788
Office Version
  1. 2010
Platform
  1. Windows
Hello hello, a non-VBA question for once.

A macro opens a spreadsheet, which is chock full of pre-existing formulas. These formulas USED TO reference a static location on our server that everyone had the same link to.

We've since moved to OneDrive, so everyones file path is now like... "C:\Users\RockandGrohl\Server\DestinationFile\Answer.xlsx"

Therefore, if I change the link in the sheet to the above string, it will only work when I open the file. So if user "Mike" runs the macro, which opens that Answer.xlsx file, the formulas will point towards RockandGrohl's file which is obviously on his PC (but the file does exist on Mike's PC, via OneDrive, just under a different path.


So is it easier to

A) Do a mass find and replace which has a dynamic username?
B) Change the links via VBA using the clever Environ("username") function?


Cheers!
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Use this function in sheet to get the username
=INFO("DIRECTORY")
remove unnecessary info and then point the Macro directory to that specific cell to make it dynamic for every user.
 
Upvote 0

Forum statistics

Threads
1,214,650
Messages
6,120,734
Members
448,987
Latest member
marion_davis

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