Macro - new sheet per name list and add template in each sheet
Closed
rfranciii
Posts
1
Registration date
Monday November 7, 2016
Status
Member
Last seen
November 7, 2016
-
Nov 7, 2016 at 08:51 PM
Richie - Nov 8, 2016 at 08:16 AM
Richie - Nov 8, 2016 at 08:16 AM
Related:
- Macro - new sheet per name list and add template in each sheet
- Pdf and xps add in 2007 - Download - Other
- Sheet right to left in google sheet - Guide
- Windows network commands cheat sheet - Guide
- Mark sheet in excel - Guide
- Little alchemy cheat sheet - Guide
1 response
vcoolio
Posts
1411
Registration date
Thursday July 24, 2014
Status
Moderator
Last seen
September 6, 2024
262
Nov 8, 2016 at 12:18 AM
Nov 8, 2016 at 12:18 AM
Hello Richie,
Have a look at the following link:-
https://www.dropbox.com/s/vkwf8tr0amfqjm2/ChukieD%28create%20sheets%20from%20template%29.xlsm?dl=0
It is a test work book for a Poster I helped a couple of months ago with a very similar query to yours.
In the above test work book, there is a Template sheet and a Summary sheet. The code creates and names new sheets for each ID in Column B of the Summary sheet with each sheet being a copy of the Template. Each client name is also placed in cell A1 of each sheet. Click on the "RUN" button to see it work.
There aren't any formulae in this example but, if there were, they would all be copied over to each new sheet.
The code associated with this example is as follows:-
Let us know what you think.
Cheerio,
vcoolio.
Have a look at the following link:-
https://www.dropbox.com/s/vkwf8tr0amfqjm2/ChukieD%28create%20sheets%20from%20template%29.xlsm?dl=0
It is a test work book for a Poster I helped a couple of months ago with a very similar query to yours.
In the above test work book, there is a Template sheet and a Summary sheet. The code creates and names new sheets for each ID in Column B of the Summary sheet with each sheet being a copy of the Template. Each client name is also placed in cell A1 of each sheet. Click on the "RUN" button to see it work.
There aren't any formulae in this example but, if there were, they would all be copied over to each new sheet.
The code associated with this example is as follows:-
Option Explicit Sub CreateSheets() Dim wsSumm As Worksheet, wsTmp As Worksheet Dim shtNames As Range, N As Range With ThisWorkbook Set wsTmp = .Sheets("Template") Set wsSumm = .Sheets("Summary") Set shtNames = wsSumm.Range("B2:B" & Rows.Count).SpecialCells(xlConstants) Application.ScreenUpdating = False For Each N In shtNames If Not Evaluate("ISREF('" & CStr(N.Text) & "'!A1)") Then wsTmp.Copy After:=.Sheets(.Sheets.Count) ActiveSheet.Name = CStr(N.Text) ActiveSheet.Range("A1").Value = N.Offset(, -1).Value End If Next N wsSumm.Select End With Application.ScreenUpdating = True End Sub
Let us know what you think.
Cheerio,
vcoolio.
Nov 8, 2016 at 08:16 AM