I use the following formula to return the location of the active "master" workbook.
=LEFT(CELL("filename"),FIND("[",CELL("filename"),1)-1)
This value is used in other formulas within the workbook as well as Power Query to identify the location of various source files in subfolders.
My problem is that I have a (lengthy) macro with multiple file operations on other "remote" workbooks, some in different folders. When the macro opens, alters, saves and subsequently closes the workbooks in those different folders the formula above changes to the location of the last-opened file. Subsequent operations depending on the master workbook locations fail.
I have tried Application.Volatile in my code after the remote workbook operations but the formula retains the last-saved location of the remote workbook. I don't want to run a calculation in the midst of quite a few Power Query operations either. I'm hoping there's an obvious way to reset the CELL(filename) value.
=LEFT(CELL("filename"),FIND("[",CELL("filename"),1)-1)
This value is used in other formulas within the workbook as well as Power Query to identify the location of various source files in subfolders.
My problem is that I have a (lengthy) macro with multiple file operations on other "remote" workbooks, some in different folders. When the macro opens, alters, saves and subsequently closes the workbooks in those different folders the formula above changes to the location of the last-opened file. Subsequent operations depending on the master workbook locations fail.
I have tried Application.Volatile in my code after the remote workbook operations but the formula retains the last-saved location of the remote workbook. I don't want to run a calculation in the midst of quite a few Power Query operations either. I'm hoping there's an obvious way to reset the CELL(filename) value.