Macro to create worksheets [Solved/Closed]

Report
-
 Mike -
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 replies

Posts
2744
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
May 10, 2021
461
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
Thank you

A few words of thanks would be greatly appreciated. Add comment

CCM 2942 users have said thank you to us this month

Wow Great,

Thank you.

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!