简体   繁体   English

Excel:如何始终链接到同一目录中的外部工作簿?

[英]Excel: How do I link to an external workbook always in the same directory?

I have file A.xlsx that has lookups to an external workbook called data.xlsx. 我有一个文件A.xlsx,它可以对名为data.xlsx的外部工作簿进行查找。 data.xlsx is generated by a script so always has the name data.xlsx and is generated in various places. data.xlsx由脚本生成,因此始终具有名称data.xlsx并在不同位置生成。

I want to copy A to different places and always have the formula inside the workbook link to the data.xlsx generated in the same directory (as mentioned, data.xlsx is a file generated by a script so has different data inside each time). 我想将A复制到不同的位置,并且始终将工作簿中的公式链接到同一目录中生成的data.xlsx(如上所述,data.xlsx是由脚本生成的文件,因此每次内部都有不同的数据)。

My formula is something like this: =IFERROR(INDEX('C:\\Users\\andrew\\Test1[data.xlsx]sheet1'!$B$2:$AG$36, MATCH($C... 我的公式是这样的:= IFERROR(INDEX('C:\\ Users \\ andrew \\ Test1 [data.xlsx] sheet1'!$ B $ 2:$ AG $ 36,MATCH($ C ...

but this links to the specific file and gives me trouble when I copy A.xlsx to different places (it effectively remembers the path to the original data.xlsx). 但这链接到特定文件,并且在我将A.xlsx复制到不同位置时给我带来麻烦(它有效地记住了原始data.xlsx的路径)。

Is there a "CurrentDir" kind of way to do this, eg =IFERROR(INDEX('[CurrentDir][data.xlsx]sheet1'!$B$2:$AG... 有没有一种“ CurrentDir”方法,例如= IFERROR(INDEX('[CurrentDir] [data.xlsx] sheet1'!$ B $ 2:$ AG ...

so that I will always read a file data.xlsx that is in the same directory as A.xlsx? 这样我将始终读取与A.xlsx位于同一目录中的data.xlsx文件?

Current Dir is ./ 当前目录为./
'C:\\Users\\andrew\\Test1[data.xlsx]sheet1'!$B$2:$AG$36, MATCH($C... 'C:\\ Users \\ andrew \\ Test1 [data.xlsx] sheet1'!$ B $ 2:$ AG $ 36,MATCH($ C ...

should be : 应该 :
'[data.xlsx]sheet1'!$B$2:$AG$36, MATCH($C... '[data.xlsx] sheet1'!$ B $ 2:$ AG $ 36,MATCH($ C ...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Excel中创建一个带有公式的链接到另一个工作簿? - How do I create a link in Excel, with a formula in it, to another Workbook? 将数据复制到新工作簿时,如何在同一目录中的多个工作簿中循环遍历 Excel 工作表? - How can I loop through Excel worksheets, in multiple workbooks in the same directory while copying data into a new workbook? 在 Excel 中使用 VBA 为目录名称执行 Workbook.open 时如何使用通配符? - How do I use a wildcard when using VBA in Excel to do Workbook.open for a directory name? 如何将Excel工作簿保存到磁盘? - How do I save an Excel workbook to disk? 如何在Excel 2016的同一工作簿中将值从一个表移动到另一个表? - How do I move a value from one table to another in the same workbook in Excel 2016? 如何使工作表1的A列中的项目出现在MS Excel的同一工作簿中的工作表2的A列中 - How do I make the items in Column A of Sheet 1 appear in Column A of Sheet 2 in the same workbook in MS Excel 如何对目录中的所有Excel文件应用相同的操作? - How do I apply the same action to all Excel Files in the directory? excel链接到同一工作簿中的另一个工作表 - excel link to another sheet in same workbook 如何使用Excel VBA将新工作簿另存为原始工作簿目录? - How can I SaveAs a new workbook to original workbook directory with Excel VBA? 如何在Excel启动时运行代码(不是workbook_open)? - How do I run code on Excel startup (not workbook_open)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM