I have a large data set with an identifier attributed to each row. There around 10 different identifiers for the whole dataset but this can be variable. The aim is to break the main dataset up into individual worksheets for each group of identifiers. I have written this code below which does the job but seems very clunky with a loop to make all the worksheets and another to go through each row.
...
'--> Get list of Area Codes
ws1.Range("N:N").Copy
Set TempWS = Sheets.Add
With TempWS
With .Range("A:A")
.PasteSpecial
.AdvancedFilter xlFilterInPlace, Unique:=True
.SpecialCells(xlCellTypeVisible).Copy
End With
.Range("B:B").PasteSpecial
.ShowAllData
.Range("A:A").Delete
.Rows(1).Delete
tmpLR = .Range("A" & Rows.Count).End(xlUp).Row + 1
End With
'--> Create Worksheet for Each Code
i = 1
Do Until i = tmpLR
Set ws = Sheets.Add
ws.Name = TempWS.Cells(i, 1).Text
ws1.Range("A1").EntireRow.Copy
ws.Rows("1:1").PasteSpecial
i = i + 1
Loop
TempWS.Delete
'--> Break Up Main Data Sheet into Area Code Sheets
Set rng = ws1.Range("N2:N" & LRws1)
For Each c In rng
shname = c.Text
c.EntireRow.Copy
Set oWS = Sheets(shname)
oLR = oWS.Range("A" & Rows.Count).End(xlUp).Row + 1
oWS.Rows(oLR).PasteSpecial
Next
...
Is there a more efficient way of completing this process instead of looping multiple times?
I also noticed that with this line c.entirerow.copy it is not possible to use a cut instead of copy, what’s the reason for this?
Format is like this:

if I can read well, the original main table would look something like this in a simplified form:
You want to create a new sheet for each of the Areacodes (named Area1,2,3) and fill in the headers + corresponding line.
The code written below is merely a framework on the table form that I have drawn, you can customize this code the way you want it.