Avatar of W.E.B
W.E.B
 asked on

Excel Macro

Hello,
Can you please help,
I'm using below code to save sheets to new workbook.
the problem I have is, the sheet names are not always the same.

how can I change the code below to say,
Copy All sheets except "Main_Sheet"

Sub Export()
     
    Dim wb As Workbook, InitFileName As String, fileSaveName As String
    InitFileName = ThisWorkbook.Path & "\ - Recon_Output_ " & Format(Date, "yyyymmdd")
     Sheets(Array("SheetM1", "SheetMG1", "SheetHM1", "SheetJM1", "SheetK1", "SheetO1", "SheetL1", "SheetJY91")).Copy
    Set wb = ActiveWorkbook
      With wb
        .SaveAs "C:\Users\Wassim\Desktop\test)
        .Close False
    End With
    Range("A1").Select
    ActiveWorkbook.SAVE
End Sub

Any help is appreciated,
Thanks
Microsoft ExcelVB ScriptVisual Basic Classic

Avatar of undefined
Last Comment
W.E.B

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Rgonzo1971

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
W.E.B

ASKER
Thank you.
Your help has saved me hundreds of hours of internet surfing.
fblack61