将工作表中的多个工作表保存到新工作簿中

时间:2018-09-27 23:51:20

标签: excel vba save

我有一个工作簿,我想将“规格表”从中保存到新工作簿中。我想为新工作簿保存的每个实例在第一张工作表中更改单元格值...说A1...。我可以得到一个没有任何问题的迭代,但是当代码使用A1的第二个值创建第二个工作簿副本时,它会用第二个保存的当前A1值覆盖第一个保存的工作簿A1单元格... < / p>

Sub writefirst()

    Dim wkb As Workbook
    Set wkb = ThisWorkbook

 wkb.Activate

    ThisWorkbook.Sheets("Round 1").Range("B3").Value = "1"
    Sheets(Array("Quest Info", "Quest Targets", "Milestone Steps", "Quest Config")). _
        Copy
    ActiveWorkbook.SaveAs FileName:= _
        "/Users/me/PuzzleOct2018_1.xlsx" _
        , FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
    ActiveWorkbook.Close

 wkb.Activate

    ThisWorkbook.Sheets("Round 1").Range("B3").Value = "2"
    Sheets(Array("Quest Info", "Quest Targets", "Milestone Steps", "Quest Config")). _
        Copy
    ActiveWorkbook.SaveAs FileName:= _
        "/Users/dme/PuzzleOct2018_2.xlsx" _
        , FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
    ActiveWorkbook.Close

0 个答案:

没有答案