Hi,
I am struggling to solve for two issues.
1) When I use the code below and a name form my list in the master sheet is >31 characters or uses : /\ ..., I get Template(x) as a name. Is there any way to handle the errors by truncating the names and getting rid of the unallowed characters?
2) I would also like to create an index in another column of the master sheet with the names and hyperlink of the newly created sheets.
The code I am using to generate the sheets is:
Sub CreateSheetsFromList()
Application.ScreenUpdating = False
Calculate
Dim projectCell As Range, projectIDcol As Range
'Dim ws As Worksheet
Set projectIDcol = Sheets("Portfolio Roadmap").Range("D4")
Set projectIDcol = Range(projectIDcol, projectIDcol.End(xlDown))
For Each projectCell In projectIDcol
On Error Resume Next
If IsError(Worksheets(projectCell.Value)) Then
Sheets("template").Select ' Select the template as the new worksheet to create
Sheets("template").Copy After:=Sheets(Sheets.Count) 'Creates a new worksheet based on the template. Worksheet will be named template(1), (2) ect....
Sheets(Sheets.Count).Name = projectCell.Value ' Renames the worksheets from the index of project.
End If
Next projectCell
Application.ScreenUpdating = True
Sheets("Portfolio Roadmap").Select
Calculate
End Sub
Thank you very much for your help,
Kind regards,
Guillaume
Bookmarks