一次复印多张(保留相关公式)

我一直在努力寻找一种方法来一次复制多张使用VBA。 问题是我需要他们保持彼此的相对参照。 例如:

I have 3 sheets: 1. Print (formulas point to TV - Input) 2. Print - Input 3. Print - plan (formulas point to TV - Input) I need to copy them so that all formulas point to their new respective sheets. 1. Print (2) (formulas point to Print - Input (2)) 2. Print - Input (2) 3. Print - plan (2) (formulas point to Print - Input (2)) 

这可以通过Ctrl轻松完成。 +将图纸拖到新的位置。 但是,如何在VBA中做到这一点?

编辑:名称“打印”设置运行时间。 所以它也可以是电视或广播。 它是从一个string中松动的。

任何帮助表示赞赏!

尝试这样的事情:

 Sheets(Array("Print", "Print - input", "Print - plan")).Copy After:=Sheets(Sheets.Count) 

编辑 –索引引用

 Sheets(Array(1, 2, 3)).Copy After:=Sheets(Sheets.Count) 

使用variables引用:

 Dim sht1 as String, sht2 as String, sht3 As String sht1 = "Print" sht2 = "Print - input" sht3 = "Print - plan" Sheets(Array(sht1, sht2, sht3)).Copy After:=Sheets(Sheets.Count) 

dynamic数组(这里是3个元素静态,但也可以是任何dynamic的):

 Dim arrSHT as Variant arrSHT = array("Print", "Print - input", "Print - Plan") Sheets(arrSHT).Copy After:=Sheets(Sheets.Count)