Macro to create worksheets

Solved/Closed
Mike Nohra - Mar 20, 2012 at 03:25 AM
 Mike - Mar 21, 2012 at 10:13 AM
Hello,

I'm Mike, I'm new to Macro excel

I need a Macro that read from a table the name of projects and create for each project a sheet named the same name as the project and containing a sample table created in Sheet2.
so i need to create sheets where the name is the same as the project and the content is the same as sheet2 ( as if i copied Sheet2).
then i will add some prjects so i need to create new sheets for the new projects but without deleting the old ones or modifiying the content of the project sheet ( i dont want to lose the data entered in each project sheet)

i appriciate your help.


2 responses

TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 552
Mar 20, 2012 at 11:13 AM
Hi Mike,

First select all the project names you want to create a sheet for. Then run the following macro:
Sub test()
Dim x As Integer
For Each cell In Selection
    x = Sheets.Count
    Sheets("Sheet2").Copy After:=Sheets(x)
    Sheets("Sheet2 (2)").Name = cell.Value
    Next cell
End Sub

When you enter new project names, simply select only the new ones and run the macro again.

Best regards,
Trowa
1
Wow Great,

Thank you.
0