How to create a Workbook with Worksheets name coming from a column listed on a different workbook.

Hi Everyone,
I am trying to create a workbookB and the tab names in the workbookB  should be coming from the names listed in the column of a workbookA. Also, All the tabs must have a similar template that is coming from the tab of a WorkbookC. Below Macro helps me in getting the tabs from a column but I would like all these tabs on a separate workbook. Any help will be appreciated   Thanks.

Sub test()

    Dim MyCell As Range, MyRange As Range
   
    Set MyRange = Sheets("Forms").Range("A2")
    Set MyRange = Range(MyRange, MyRange.End(xlDown))

    For Each MyCell In MyRange

        Sheets.Add After:=Sheets(Sheets.Count) 'creates a new worksheet
        Sheets(Sheets.Count).Name = MyCell.Value ' renames the new worksheet
    Next MyCell

End Sub
Template.xlsx
Milind AgarwalAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

Martin LissOlder than dirtCommented:
Sub test()

    Dim wbNew As Workbook
    Dim wbThis As Workbook
    Dim lngRow As Long
    
    Set wbThis = ThisWorkbook
    Set wbNew = Workbooks.Add
    
    wbNew.SaveAs Filename:="C:\temp\WorkbookB" ' Change as needed
    
    For lngRow = 2 To wbThis.Sheets("Forms").Range("A1048576").End(xlUp).Row
        wbThis.Sheets("Template Tab").Copy After:=wbNew.Sheets(wbNew.Sheets.Count)
        wbNew.Sheets(Sheets.Count).Name = wbThis.Sheets("Forms").Cells(lngRow, 1).Value 
    Next

End Sub

Open in new window

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
Milind AgarwalAuthor Commented:
Thank You Martin!!
Martin LissOlder than dirtCommented:
You're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2015
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
VB Script

From novice to tech pro — start learning today.