Sub Group_2()
Dim LASTROW As Long
Dim I As Long
Dim ROW_Beg As Long
Dim ROW_End As Long
I = 1
For I = 1 To 10000
If Cells(I, 1).Value = -1 Then
LASTROW = I - 1
End If
Next
ROW_Beg = 0
ROW_End = 0
For I = 1 To LASTROW
If (Cells(I, 1).Value = 2 Or Cells(I, 1).Value = 3 Or Cells(I, 1).Value = 4 Or Cells(I, 1).Value = 5 Or Cells(I, 1).Value = 6 Or Cells(I, 1).Value = 7 Or Cells(I, 1).Value = 8 Or Cells(I, 1).Value = 9 Or Cells(I, 1).Value = 10) Then
If (ROW_Beg <> 0) Then
ROW_End = I
End If
Else
ROW_Beg = I + 1
End If
If ((ROW_Beg <> 0) And (ROW_End <> 0)) Then
Rows(ROW_Beg & ":" & ROW_End).Group
ROW_Beg = ROW_Beg + 1
ROW_End = 0
End If
Next I
ROW_Beg = 0
ROW_End = 0
For I = 1 To LASTROW
If (Cells(I, 1).Value = 3 Or Cells(I, 1).Value = 4 Or Cells(I, 1).Value = 5 Or Cells(I, 1).Value = 6 Or Cells(I, 1).Value = 7 Or Cells(I, 1).Value = 8 Or Cells(I, 1).Value = 9 Or Cells(I, 1).Value = 10) Then
If (ROW_Beg <> 0) Then
ROW_End = I
End If
Else
ROW_Beg = I + 1
End If
If ((ROW_Beg <> 0) And (ROW_End <> 0)) Then
Rows(ROW_Beg & ":" & ROW_End).Group
ROW_Beg = ROW_Beg + 1
ROW_End = 0
End If
Next I
ROW_Beg = 0
ROW_End = 0
For I = 1 To LASTROW
If (Cells(I, 1).Value = 4 Or Cells(I, 1).Value = 5 Or Cells(I, 1).Value = 6 Or Cells(I, 1).Value = 7 Or Cells(I, 1).Value = 8 Or Cells(I, 1).Value = 9 Or Cells(I, 1).Value = 10) Then
If (ROW_Beg <> 0) Then
ROW_End = I
End If
Else
ROW_Beg = I + 1
End If
If ((ROW_Beg <> 0) And (ROW_End <> 0)) Then
Rows(ROW_Beg & ":" & ROW_End).Group
ROW_Beg = ROW_Beg + 1
ROW_End = 0
End If
Next I
ROW_Beg = 0
ROW_End = 0
For I = 1 To LASTROW
If (Cells(I, 1).Value = 5 Or Cells(I, 1).Value = 6 Or Cells(I, 1).Value = 7 Or Cells(I, 1).Value = 8 Or Cells(I, 1).Value = 9 Or Cells(I, 1).Value = 10) Then
If (ROW_Beg <> 0) Then
ROW_End = I
End If
Else
ROW_Beg = I + 1
End If
If ((ROW_Beg <> 0) And (ROW_End <> 0)) Then
Rows(ROW_Beg & ":" & ROW_End).Group
ROW_Beg = ROW_Beg + 1
ROW_End = 0
End If
Next I
ROW_Beg = 0
ROW_End = 0
For I = 1 To LASTROW
If (Cells(I, 1).Value = 6 Or Cells(I, 1).Value = 7 Or Cells(I, 1).Value = 8 Or Cells(I, 1).Value = 9 Or Cells(I, 1).Value = 10) Then
If (ROW_Beg <> 0) Then
ROW_End = I
End If
Else
ROW_Beg = I + 1
End If
If ((ROW_Beg <> 0) And (ROW_End <> 0)) Then
Rows(ROW_Beg & ":" & ROW_End).Group
ROW_Beg = ROW_Beg + 1
ROW_End = 0
End If
Next I
ROW_Beg = 0
ROW_End = 0
For I = 1 To LASTROW
If (Cells(I, 1).Value = 7 Or Cells(I, 1).Value = 8 Or Cells(I, 1).Value = 9 Or Cells(I, 1).Value = 10) Then
If (ROW_Beg <> 0) Then
ROW_End = I
End If
Else
ROW_Beg = I + 1
End If
If ((ROW_Beg <> 0) And (ROW_End <> 0)) Then
Rows(ROW_Beg & ":" & ROW_End).Group
ROW_Beg = ROW_Beg + 1
ROW_End = 0
End If
Next I
ROW_Beg = 0
ROW_End = 0
For I = 1 To LASTROW
If (Cells(I, 1).Value = 8 Or Cells(I, 1).Value = 9 Or Cells(I, 1).Value = 10) Then
If (ROW_Beg <> 0) Then
ROW_End = I
End If
Else
ROW_Beg = I + 1
End If
If ((ROW_Beg <> 0) And (ROW_End <> 0)) Then
Rows(ROW_Beg & ":" & ROW_End).Group
ROW_Beg = ROW_Beg + 1
ROW_End = 0
End If
Next I
ROW_Beg = 0
ROW_End = 0
For I = 1 To LASTROW
If (Cells(I, 1).Value = 9 Or Cells(I, 1).Value = 10) Then
If (ROW_Beg <> 0) Then
ROW_End = I
End If
Else
ROW_Beg = I + 1
End If
If ((ROW_Beg <> 0) And (ROW_End <> 0)) Then
Rows(ROW_Beg & ":" & ROW_End).Group
ROW_Beg = ROW_Beg + 1
ROW_End = 0
End If
Next I
ROW_Beg = 0
ROW_End = 0
For I = 1 To LASTROW
If (Cells(I, 1).Value = 10) Then
If (ROW_Beg <> 0) Then
ROW_End = I
End If
Else
ROW_Beg = I + 1
End If
If ((ROW_Beg <> 0) And (ROW_End <> 0)) Then
Rows(ROW_Beg & ":" & ROW_End).Group
ROW_Beg = ROW_Beg + 1
ROW_End = 0
End If
Next I
End Sub