Advertisement
YasserKhalil2019

T4478_Split To Worksheets By List In Column

Dec 31st, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. https://excel-egy.com/forum/t4478
  2. ---------------------------------
  3.  
  4. Sub Split_To_Worksheets_By_List_In_Column()
  5. Dim a, i As Long, dic As Object
  6. Set dic = CreateObject("Scripting.Dictionary")
  7. With Sheets("Sheet3").Cells(1).CurrentRegion
  8. a = .Columns(2).Value
  9. For i = 2 To UBound(a, 1)
  10. If Not dic.Exists(a(i, 1)) Then
  11. dic(a(i, 1)) = Empty
  12. If Not Evaluate("ISREF('" & a(i, 1) & "'!A1)") Then
  13. Sheets.Add(, Sheets(Sheets.Count)).Name = a(i, 1)
  14. End If
  15. Sheets(a(i, 1)).Cells.Clear
  16. .AutoFilter 2, a(i, 1)
  17. .Copy Sheets(a(i, 1)).Cells(1)
  18. .AutoFilter
  19. End If
  20. Next i
  21. End With
  22. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement