Public Function tester()
Dim iam As Long
Dim jam
Dim p1 As Integer
Dim p2 As Integer
Dim p3 As Integer
Dim p4 As Integer
Dim p5 As Integer
Dim p6 As Integer
Dim p7 As Integer
iam = Range("K" & Rows.Count).End(xlUp).Row
For jam = 7 To iam
If Cells(jam, 11) = 2 Then
p1 = Cells(jam - 1, 11) '............last 1's
Else
If Cells(jam, 11) = 3 Then
p2 = Cells(jam - 1, 11) '............last 2's
Else
If Cells(jam, 11) = 4 Then
p3 = Cells(jam - 1, 11) '............last 3's
Else
If Cells(jam, 11) = 5 Then
p4 = Cells(jam - 1, 11) '............last 4's
Else
If Cells(jam, 11) = 6 Then
p5 = Cells(jam - 1, 11) '............last 5's
Else
If Cells(jam, 11) = 7 Then
p6 = Cells(jam - 1, 11) '............last 6's
Else
If Cells(jam, 11) = "" Then
p7 = Cells(jam - 1, 11) '............last 7's
End If
End If
End If
End If
End If
End If
End If
Next
MsgBox p1
Rows("7:" & p1).Group - error "Type Mismatch"
Rows("p1:" & p2).Group
Rows("p2:" & p3).Group
Rows("p3:" & p4).Group
Rows("p4:" & p5).Group
Rows("p5:" & p6).Group
Rows("p6:" & p7).Group
End Function