我在工作簿(名为'财务报表生成器')中有两个工作表(名为' Q4财务状况'以及' Q4 Activites'),我需要将工作表复制到新工作簿中。
工作表' Q4财务状况'有一个单元格公式为='Q4 Activities'!F37 - H56 - H57
当我复制到新工作簿时,公式将更改为='[Financial Statement Generator.xlsm]Q4 Activities'!F37 - H56 - H57
excel中是否有其他替代方法可以保留公式,并将工作表复制到新工作簿中。
我正在通过宏进行复制表 -
Dim sheetName As Variant
Set wb = Workbooks.Add
sheetName = Array("Q" & Quarter & " Financial Condition", "Q" & Quarter & " Activities")
ThisWorkbook.sheets(sheetName(1)).Copy Before:=wb.sheets(1)
ThisWorkbook.sheets(sheetName(0)).Copy Before:=wb.sheets(1)
答案 0 :(得分:1)
一次复制一个工作表将会出现您描述的问题。简单的方法是一次复制两张纸:
Dim sheetName As Variant
Set wb = Workbooks.Add
sheetName = Array("Q" & Quarter & " Financial Condition", "Q" & Quarter & " Activities")
ThisWorkbook.sheets(sheetName).Copy Before:=wb.sheets(1)