問題描述
從另一個 Excel 文件更新圖表 (Update chart form another Excel file)
我有 2 個 Excel 文件。首先是圖表(我將其命名為chart.xlsm),其次是圖表數據(data.xlsm)。第二個文件通過鏈接進行連接。
在第一個文件中,我有一個帶有日期編號的軸的圖表。當我打開文件時,它以 2016‑01 結尾。但是當我打開第二個文件(使用“開源”按鈕)時,圖表會更新並以 2016‑03 結束。
我查看了屬性,
在打開數據之前。 xlsm
Series values : =[0]!ATTs
Axis label range : =[0]!DatesValues
打開data.xlsm後
Series values : ='chart.xlsm'!ATTs
Axis label range : ='chart.xlsm'!DatesValues
“更新值”選項不會更新圖表。有沒有辦法在不打開 data.xlsm 的情況下更新此圖表?
編輯:在 chart.xlsm 中有另一個表格從 data.xlsm 中獲取數據。不同之處在於另一張紙採用單個單元格,而不是范圍。這些值正在更新,圖表沒有。
參考解法
方法 1:
I'm not sure how you are linking the chart to the data file, but I assume you are doing it via VBA, seeing that you are using xlsm.
The easiest way of getting what you want is to simply open chart.xlsx and data.xlsm, then create the chart and select the data you want to show from data. The downside of this solution is, that Excel will create a fixed link path to data.xlsm.
EDIT based on comment: Under "Data > edit links" you can edit the files Excel linked to. Sometimes in older versions these links used to break when the source file was open during creation (it wrote source.xls instead of \network_folder\source.xlsx, which would remove the ability to update data correctly if the source file was not open)
In that case edit the link manually and point it correctly to \\yourshare\yoursubfolder\sourcefile.xls