The operative word here is "Ooops". You've put "M" in the code but the data set only stretches out to "K" in the main sheet. So Excel is basically standing there with hands on hips saying:"Well, what do you want me to do?"
Create the required data columns out to "M" and you should be on the "straight and narrow".
However, maybe alter the code slightly as follows:-
Application.ScreenUpdating = False
Dim ar As Variant
Dim i As Integer
Dim LR As Long
Dim c As Range
Dim ws As Worksheet
LR = Range("A" & Rows.Count).End(xlUp).Row
ar = Sheet1.Range("A2", Sheet1.Range("A" & Sheet1.Rows.Count).End(xlUp))
For Each c In Range("A2:A" & LR)
Set ws = Nothing
On Error Resume Next
Set ws = Worksheets(c.Value)
If ws Is Nothing Then
Worksheets.Add(After:=Sheets(Sheets.Count)).Name = c.Value
For i = 0 To UBound(ar)
Range("A1", Range("A" & Rows.Count).End(xlUp)).AutoFilter 1, ar(i, 1)
[A1].CurrentRegion.Copy Sheets(ar(i, 1)).Range("A" & Rows.Count).End(xlUp)
Application.CutCopyMode = False
Application.ScreenUpdating = True
MsgBox "Sheets created/data transfer completed!", vbExclamation, "Status"
You may notice the slight change to line 29 between the two codes above. This should take care of any blank columns in the data set should you ever have any.
Following is the link to my updated test work book:-
And in the idea of being in a "fiddle-proof" mode, would this version of the workbook work if I made a drop down menu for the Code? Or is that more scripting? Lol
If you mean the "Code" column (Column A) then you would need to create a data validation drop down in each cell in Column A. Its fairly easy to do.
If you are worried about your work mates fiddling with things then it may be best to pass word protect the work book. Go to the Review tab and select "Protect Work Book". You'll be given the option to create a password.
PS. Doesn't really matter but yes, girl. (I am amazeballs at breaking things, horrendous at fixing them)
Haha. Sounds like my missus!
Good luck Notsonerdy! Come back if you get stuck.