Forum Discussion
cre8v1
Jan 08, 2020Copper Contributor
Macro for adding named sheets in workbook from list
I am looking for a macro to add named sheets from a selected list to a workbook. Specifically, each sheet would have the same content duplicated from a template sheet, but named differently accordin...
- Jan 19, 2020
I believe your question is to add worksheets (copied from a template) into a workbook based on a list, rather than list all the worksheets in the workbook.
The attached file has a working example, which includes the following short and easy to adapt (to your own situation) piece of code:
Sub AddSheets() Dim SheetList As Object Dim i As Integer Dim SheetName As String Set SheetList = ThisWorkbook.Sheets("SheetsToAdd").Range("A1").CurrentRegion For i = 1 To SheetList.Rows.Count SheetName = SheetList.Cells(i, 1) Sheets("Template").Select Sheets("Template").Copy After:=Sheets(Sheets.Count) ActiveSheet.Name = SheetName Next i End Sub
Abiola1
Jan 18, 2020MVP
Hello,
Kindly find the solution to your question in the link below
https://www.automateexcel.com/vba/list-all-sheets-in-workbook/
If that answers your question, kindly accept as the Best Response. Thanks
Kindly find the solution to your question in the link below
https://www.automateexcel.com/vba/list-all-sheets-in-workbook/
If that answers your question, kindly accept as the Best Response. Thanks
- cre8v1Jan 21, 2020Copper Contributor
Abiola1 Thank you for your response. My request was not as clear as it should have been. Riny_van_Eekelen was able to understand what I was looking for.
Thanks again for trying.