Dealing with changing formula reference paths in shared folders

mikenelena

Board Regular
Joined
Mar 5, 2018
Messages
139
Office Version
  1. 365
Platform
  1. Windows
We have a main payroll workbook that pulls data (a mileage total) from a closed workbook in a shared folder. Several of us take turns running payroll, and the reference paths fall apart if the payroll is run from a computer other than the one at which the formula references were entered. I am looking for away to update those reference paths based on the current user/ computer.

I'm familiar with the environ ("username") in VBA, and I thought that capturing the current user into a cell might be a stepping stone to getting these reference formula paths correct. So I captured the user name in 1 cell, wrote the remainder of the path in another, and tried combining them, but that produced a text string and not the formula reference with desired data.

Maybe there is away to convert that text to a formula reference?

I'm open to other ideas too.

Thanks for any suggestions!

... Mike
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hi

Code:
Sub MyFormula()


MsgBox Environ("username"), 64, "This can be inserted in the formula."


' or get it from cell G53


[g55].Formula = "='c:\" & [g53] & "\[erpf.xlsm]disp'!$b$26"
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,335
Messages
6,124,326
Members
449,155
Latest member
ravioli44

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