Greetings,
I have a macro that creates worksheets based on the values in column A; 1 tab for each value with that value as the tabs name.
The next step, where I'm completely lost, is to have each of these new tabs be a copy of the "tab setup" worksheet with the value in cell B1 matching the tab name.
I've attached a workbook to help explain my desired outcome, any and all assistance is greatly appreciated.
tab setup for excel forum.xlsm
Current code is shown below:
Sub Generate_Tabs() Dim strCol As String Dim strRow As String Dim rngStart As Range Dim rngEnd As Range Dim rngCell As Range Dim strWsName As String Dim strSrcName As String On Error GoTo ErrHnd strCol = "A" strRow = "2" Application.ScreenUpdating = False strSrcName = ActiveSheet.Name Set rngStart = ActiveSheet.Range(strCol & strRow) Set rngEnd = ActiveSheet.Range(strCol & CStr(Application.Rows.Count)).End(xlUp) For Each rngCell In ActiveSheet.Range(rngStart, rngEnd) If rngCell.Text <> "" Then strWsName = rngCell.Text On Error Resume Next If Worksheets(strWsName) Is Nothing Then On Error GoTo ErrHnd Worksheets.Add After:=Worksheets(Worksheets.Count) Worksheets(Worksheets.Count).Name = strWsName Else On Error GoTo ErrHnd End If End If Next rngCell Worksheets(strSrcName).Activate Application.ScreenUpdating = True Exit Sub ErrHnd: Err.Clear Worksheets(strSrcName).Activate Application.ScreenUpdating = True End Sub
Bookmarks