Hello. I have some trouble to get working my loop. Here is the code:

If frmStart.multiPageD.Pages(0).optButton.Value = True Then

LastRow = Cells(Rows.Count, "A").End(xlUp).Row

For a = 1 To LastRow - 1
If frmStart.multiPageD.Pages(0).frameF.Controls("CheckBox" & a).Value = True Then
checked = frmStart.multiPageD.Pages(0).frameF.Controls("CheckBox" & a).Caption

ActiveWorkbook.Sheets("1").Activate
Range("A1").Select
LastCol = Cells(1, Columns.Count).End(xlToLeft).Column
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
For b = 1 To LastRow
ActiveWorkbook.Sheets("1").Activate

If Cells(b, "A").Value = checked Then

LastCol = Cells(1, Columns.Count).End(xlToLeft).Column
For c = 1 To LastCol
ActiveWorkbook.Sheets("1").Activate
If Cells(b, c).Value = "1" Then
ast = Cells("1", c).Value
ActiveWorkbook.Sheets("2").Activate
Range("A1").Select
LastCol = Cells(1, Columns.Count).End(xlToLeft).Column

For d = 1 To LastCol
If Cells("1", d).Value = ast Then '<<<< THIS WORKS ONLY ONE TIME. 2nd, 3rd... loop doesn't work
LastRow = Cells(Rows.Count, "A").End(xlUp).Row

For e = 1 To LastRow
If Cells(e, d).Value = 1 Or Cells(e + 1, d).Value = 1 Or Cells(e + 2, d).Value = 1 Then

m = Cells(e, "A").Value
ActiveWorkbook.Sheets("3").Activate
LastCol = Cells(1, Columns.Count).End(xlToLeft).Column
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
For f = 1 To LastRow
ActiveWorkbook.Sheets("3").Activate
If Cells(f, "A").Value = m Then
For g = 1 To LastCol
If Cells(f, g).Value = 1 Then
QS = Cells("1", g).Value
ActiveWorkbook.Sheets("QSs").Activate
Range("A1").Select
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
For h = 1 To LastRow
If Cells(h, "A").Value = QS Then
'<<<<<<<<< FIND ROWS UNTIL A=STOP, COPY TO NEW WORKBOOK. HELP ON THIS ???

End If
Next h
End If
Next g
End If
Next f
End If
Next e
End If
Next d
End If
Next c
End If
Next b

Please help me! It makes me mad!!!!!