Excel - A macro to create worksheets

December 2016


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.


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.

Thanks to TrowaD for this tip.

Related :

This document entitled « Excel - A macro to create worksheets » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.