Copy select Excel sheet from workbook to new workbook

I have a workbbok with many tabs.  I would like to have two of the tabs copied out to a new excel file which only contains these two sheets.  The two sheet I want to copy are called "data" and "report".  I want a new excel file that has these two sheets,  Can I do this through VBA?
marku24Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

J NUnicorn wranglerCommented:
why dont you copy the old file and rename it and delete the tabs you dont want
0
marku24Author Commented:
I have over 25 tabs in the workbook.  Seems inefficient to do it that way.
0
GlowmanCommented:
here is a little code to get you started.

Public Sub MakeNew()
   
    Application.SheetsInNewWorkbook = 2
   
    Dim wbNew As Workbook
    Set wbNew = Workbooks.Add

    wbNew.Sheets(1).Name = "Data"
    wbNew.Sheets(2).Name = "Reports"
   
    ThisWorkbook.Sheets("Data").Cells.Copy wbNew.Sheets(1).Range("A1")
    ThisWorkbook.Sheets("Reports").Cells.Copy wbNew.Sheets(2).Range("A1")
   
    wbNew.Close True, "C:\Temp\NewWB.xlsx"
    Set wbNew = Nothing
   
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
marku24Author Commented:
nicely done.  good starting point.  thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Applications

From novice to tech pro — start learning today.