Not 100% sure this is right; your sort code may also need fixing
Sub CopyPasteWithModelIds()
Dim NextRow As Long
Dim NrOfCopies As Long
Dim ModelIds As String
Dim ModelIdArray() As String
Dim Rws As Long, i As Long
NrOfCopiesMaximum = 5 'Added to run code
Do
On Error Resume Next
ModelIds = Application.InputBox(prompt:="Enter Model IDs as comma delimited list.", _
Title:="Model IDs To Populate")
On Error GoTo 0
If IsEmpty(ModelIds) Then
Exit Sub
End If
ModelIdArray = Split(ModelIds, ",")
NrOfCopies = UBound(ModelIdArray)
If NrOfCopies = 0 Then
MsgBox "No copies made.", vbInformation, "CANCELLED"
Exit Sub
End If
Loop While NrOfCopies < 1 Or NrOfCopies > NrOfCopiesMaximum
With Selection
Rws = .Rows.Count 'for convenience
NextRow = .Row + Rws
Rows(NextRow & ":" & NextRow + Rws * (NrOfCopies) - 1).Insert Shift:=xlDown
.EntireRow.Copy Rows(NextRow & ":" & NextRow + Rws * (NrOfCopies) - 1)
'Added @@@@@
For i = 0 To NrOfCopies
Cells(Selection.Row, 3).Offset(i * Rws).Resize(Rws) = ModelIdArray(i)
Next
'@@@@@@@
.Resize(.Rows.Count * (NrOfCopies + 1)).Sort key1:=.Cells(1, 1)
End With
End Sub