Macro to duplicate sheet as per lista nd final liste

Chaturvedi, Santosh 590 Reputation points
2026-10-05T10:42:33.6+00:00

I want macro.

  1. It should go to the sheet name "Dash Board", read the liste from cell C20 till its end.
  2. Duplicate the sheets same as "Master_Template" present in same workbook and rename teh duplicated sheet same as name mention in C20 in step 1.
  3. The duplicated sheet name shall be entered in "Dash Board" in cell F20 below with hyperlinked with respective sheet.
  4. The duplicated sheet shall be placed inbetween the sheet named as "Master_Template" and "Input_Data" present in same workbook.
  5. All the sheets as mentioned above in same workbook.
Microsoft 365 and Office | Excel | For home | Windows
0 comments No comments

Answer accepted by question author

AI answer

2026-10-05T10:42:48.5966667+00:00

Use a VBA macro that:

  1. Reads names from Dash Board!C20:C... until the last used row in column C.
  2. Copies Master_Template.
  3. Renames each copied sheet to the value from column C.
  4. Places the copied sheet after Master_Template, which keeps the created sheets between Master_Template and Input_Data.
  5. Writes the created sheet name to column F starting at F20 and adds a hyperlink to that sheet.
Sub CopyAndRenameSheets()
    Dim wsDash As Worksheet
    Dim wsTemplate As Worksheet
    Dim wsNew As Worksheet
    Dim lastRow As Long
    Dim i As Long
    Dim newName As String
    Dim outRow As Long
    
    Set wsDash = ThisWorkbook.Worksheets("Dash Board")
    Set wsTemplate = ThisWorkbook.Worksheets("Master_Template")
    
    lastRow = wsDash.Cells(wsDash.Rows.Count, "C").End(xlUp).Row
    outRow = 20
    
    For i = 20 To lastRow
        newName = Trim(wsDash.Cells(i, "C").Value)
        
        If newName <> "" Then
            wsTemplate.Copy After:=wsTemplate
            Set wsNew = ActiveSheet
            wsNew.Name = newName
            
            wsDash.Cells(outRow, "F").Value = newName
            wsDash.Hyperlinks.Add _
                Anchor:=wsDash.Cells(outRow, "F"), _
                Address:="", _
                SubAddress:="'" & newName & "'!A1", _
                TextToDisplay:=newName
            
            outRow = outRow + 1
        End If
    Next i
End Sub

If the goal is to keep the copied sheets in the same order as the list, this works because each new sheet is copied after Master_Template, so the newest copy is inserted directly after it.

If duplicate or invalid sheet names exist in column C, the rename step will fail. Sheet names must be valid and unique.


AI-generated content may be incorrect. Read our transparency notes for more information.

Was this answer helpful?

1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Chaturvedi, Santosh 590 Reputation points
    2026-10-05T10:48:02.73+00:00

    The 1st duplicated sheet shall come next to "Master_Template" and so on

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.