Results 1 to 9 of 9

Thread: New Workbook for each worksheet

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    nevermind... i found it. at the end you have:
       With wSheetStart 
        For Each rCell In rRange 
            ManagerList = rCell 
            .Range("A1").AutoFilter 1, ManagerList 
            Worksheets(ManagerList).Delete 
            ' Add sheet named as content of rCell
            Worksheets.Add().Name = ManagerList 
            ' Copy the visible filtered range and leave hidden rows
            .UsedRange.Copy Destination:=ActiveSheet.Range("A1") 
            ActiveSheet.Cells.Columns.AutoFit 
        Next rCell 
        End With
    we want to throw the code somewhere in there before the "next rCell"

    ' Set the path somewhere before it all
    fldr = ThisWorkbook.Path 
    With wSheetStart 
        For Each rCell In rRange 
            ManagerList = rCell 
            .Range("A1").AutoFilter 1, ManagerList 
            Worksheets(ManagerList).Delete 
            ' Add sheet named as content of rCell
            Worksheets.Add().Name = ManagerList 
            ' Copy the visible filtered range and leave hidden rows
            .UsedRange.Copy Destination:=ActiveSheet.Range("A1") 
            ActiveSheet.Cells.Columns.AutoFit 
            '--Add it here--
            ThisWorkbook.Sheets(ManagerList).Select 
            ThisWorkbook.Sheets(ManagerList).Copy 
            ' I'm not sure if "ManagerList will be mutually exclusve, so I added 'rcell' into the workbook name so each one is unique
            ActiveWorkbook.SaveAs (fldr & "\ManagerList & " - " & rCell) 
            Workbooks(ManagerList & " - " & rCell & ".xlsx").Close 
            '-------------------
        Next rCell 
        End With
    Last edited by Aussiebear; 03-09-2025 at 09:07 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •