Creating different worksheets and the name coming is from a column listed on a Tab.

Hello,
I have a question regarding a VB if someone could able to help that would be great. I have a WorkbookA having Tabs "Forms" and  "Template Tab". I am trying to come up with a Macro that would create tabs coming from the names listed in the column A of the tab "Forms" . Also, this tab (Forms) has a True and False populating in column D. Only the True ones should be taken into consideration. All the new tabs that are being created should be the duplicates of "Template Tab".   Any help would be greatly appreciated.
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.

Saurabh Singh TeotiaCommented:
Few Questions..

1. In your workbook i wasn't able to find form tab..can you please update the example which has that tab..
2. For Each new template tab which is created what will be the name of the tab which is created??
3. You want the template tab to be hidden or visible??

Saurabh...
Wayne Taylor (webtubbs)Commented:
The posted workbook does not have a worksheet named "Forms". However, if I assume the names are in column A and it starts in row 2, you could use this...

Sub createWorksheets()

    Dim r As Long, TemplateWS As Worksheet
    Set TemplateWS = Worksheets("Template Tab")
    For r = 2 To Worksheets("Forms").Cells(Rows.Count, "A").End(xlUp).Row
        If Worksheets("Forms").Cells(r, "D") = True Then
            TemplateWS.Copy after:=Worksheets(Worksheets.Count)
            ActiveSheet.Name = Worksheets("Forms").Cells(r, "A")
        End If
    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:
Worked like dream. Thanks Wayne.
Milind AgarwalAuthor Commented:
Hi All,  If I could get some help in incorporating the below code to the above code that would great. The ranges would not be hard coded like I did in the example below as it is going to Vary

Sub OneCell()
    Sheets("Table of Contents").Range("A9:A50").Value = Sheets("Forms").Range("C2:C42").Value
    Sheets("Table of Contents").Range("B9:B50").Value = Sheets("Forms").Range("A2:A42").Value
End Sub


Existing VB Code:

Sub createWorksheets()

    Dim r As Long, TemplateWS As Worksheet
    Set TemplateWS = Worksheets("Template Tab")
    For r = 2 To Worksheets("Forms").Cells(Rows.Count, "A").End(xlUp).Row
        If Worksheets("Forms").Cells(r, "D") = True Then
            TemplateWS.Copy after:=Worksheets(Worksheets.Count)
            ActiveSheet.Name = Worksheets("Forms").Cells(r, "A")
        End If
    Next
   
End Sub
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 Excel

From novice to tech pro — start learning today.