I have a spreadsheet with a header row and columns A-P. In column H I have multiple names and they do duplicate. I have used the code below and it creates the new worksheets/tabs based on the names in column H and copies over the header. I can't seem to get this to copy over actual data. Part two of this, is I need to use the same data but instead of creating worksheets I need it to create new workbooks for the individual names and copy over the data.
This is code I lifted from here with my changes.
Code:
Sub AddManagerTab()
Dim Cl As Range
Dim UsdRws As Long
Dim OSht As Worksheet
Application.ScreenUpdating = False
Set OSht = Sheets("Raw")
UsdRws = OSht.Range("H" & Rows.Count).End(xlUp).Row
OSht.Range("A1:P1").AutoFilter
With CreateObject("scripting.dictionary")
For Each Cl In Range("H2:H" & UsdRws)
If Not .exists(Cl.Value) Then
.Add Cl.Value, Nothing
OSht.Range("A1:P" & UsdRws).AutoFilter field:=15, Criteria1:=Cl.Value
Sheets.Add(After:=Sheets(Sheets.Count)).Name = Cl.Value
OSht.Range("A1:P" & UsdRws).SpecialCells(xlCellTypeVisible).Copy _
Sheets(Cl.Text).Range("A1")
End If
Next Cl
End With
OSht.Range("A1:P").AutoFilter
End Sub
This is code I lifted from here with my changes.