Copy multiple worksheets from workbook and create a new workbook and save this file to new destination with name change and break links

29 views Asked by At

I am trying to take multiple worksheets from workbook and save them to a new workbook with a new name and destination. when I have (122, 222) to save multiple worksheets its doesn't let me run it only with one worksheet (122). I also want it to break the link from where it came from originally how can i include that in this code.

Option Explicit

Sub Copysheetandsave() 'says error here

    Dim sourceWs As Worksheet, savePath As String

    Set sourceWs = ThisWorkbook.Worksheets("215",220") 'wont work with taking two tabs only one

    OneDrive - Consilio\savePath = "C:\Users\"

    sourceWs.Copy
    With ActiveWorkbook
        .SaveAs Filename:=savePath & "Global App Support 2023 YTD.xlsx"
        
Sub break_link() 'want to include breaking link from new workbook
Acitveworkbook.BreakLink ext_link

        .Close False
    End With

End Sub
``
0

There are 0 answers