Sub Test()
Dim I, J As Integer
Dim StudentHeadcount As Integer, ClassRoom As Integer
StudentHeadcount = 2200
ClassRoom = IIf(Int(StudentHeadcount / 35) = StudentHeadcount / 35, StudentHeadcount / 35, Int(StudentHeadcount / 35) + 1)
J = 1
For I = 1 To StudentHeadcount Step ClassRoom
Range(Cells(I, 5), Cells(I + ClassRoom - 1, 5)) = J
J = J + 1
Next I
End Sub