I have a formula in an excel workbook that pulls data from another workbook as part of a macro. These two workbooks are in the same folder. However, I plan on sharing the folder with others so that they can utilize my macro to run reports. If another user opens these files, will the VBA code update automatically to wherever the new user saves the folder?
If not, is there a script I can write to update the file path automatically? Or is there at least a way I can make it easy for users who don't know VBA to update the macro so it works on their PC?
Here is my formula:
"=IFERROR(IF(RC[-12]=""Adjustment"",VLOOKUP(R[-1]C[-11],'C:\Attendance Audits FINAL\Test Final Package\Kronos Only\[Kronos Adjustment.xlsx]Sheet1'!R2C1:R531C3,3,FALSE)-R[-1]C[-1],""""),0)"
I am not really an expert in VBA myself, but my initial thought is to define a variable that contains the filepath so users would only have to change the name of the variable.
dim FP as string
FP = 'C:\Attendance Audits FINAL\Test Final Package\Kronos Only\
So then my formula would become:
"=IFERROR(IF(RC[-12]=""Adjustment"",VLOOKUP(R[-1]C[-11],FP[Kronos Adjustment.xlsx]Sheet1'!R2C1:R531C3,3,FALSE)-R[-1]C[-1],""""),0)"
I am not sure this will work. Any thoughts would be greatly appreciated!