Sub copy()
Show
NewSteps
Dim c, c1 As Range
Dim lrow, lrowdest, lrowref, col, i As Integer
lrowref = Sheets("Reference Chart").Cells(Rows.Count, "B").End(xlUp).Row
lrow = Sheets("BoB").Cells(Rows.Count, "A").End(xlUp).Row
i = 2
Do While i <> 0
For Each c In Sheets("Reference Chart").Range("B4:B" & lrowref)
For Each c1 In Sheets("BoB").Range("F2:F" & lrow)
If (c.Offset(, 2) = "RIC 1.2 MAY.09" Or c.Offset(, 2) = "RIC 1.2 DEC.11") And InStr(c1, c) > 0 And c1.Offset(, i) >= c.Offset(, 3) And c1.Offset(, i) <= c.Offset(, 4) And IsEmpty(c1.Offset(, 7)) = True Then
c1.Offset(, 7) = c.Offset(, 2)
col = Sheets(c1.Offset(, 7).Value).Cells.Find(what:="Policy Number").Column
lrowdest = Sheets(c1.Offset(, 7).Value).Cells(Rows.Count, col).End(xlUp).Offset(1).Row
Range(c1.Offset(, -5), c1.Offset(, 2)).copy Sheets(c1.Offset(, 7).Value).Cells(lrowdest, col)
c1.Offset(, 4).copy Sheets(c1.Offset(, 7).Value).Cells(lrowdest, col + 8)
ElseIf (c.Offset(, 2) = "No Rider Restrictions" Or c.Offset(, 2) = "02 Products or Older") And c <> "Blank" And InStr(c, "Managed Annuity Program") = 0 And InStr(c, "Family Income Protector") = 0 And InStr(c1, c) > 0 And c1.Offset(, i) >= c.Offset(, 3) And c1.Offset(, i) <= c.Offset(, 4) And IsEmpty(c1.Offset(, 7)) = True Then
c1.Offset(, 7) = c.Offset(, 2)
col = Sheets(c1.Offset(, 7).Value).Cells.Find(what:="Policy Number").Column
lrowdest = Sheets(c1.Offset(, 7).Value).Cells(Rows.Count, col).End(xlUp).Offset(1).Row
Range(c1.Offset(, -5), c1.Offset(, 2)).copy Sheets(c1.Offset(, 7).Value).Cells(lrowdest, col)
ElseIf (c.Offset(, 2) = "No Rider Restrictions" Or c.Offset(, 2) = "02 Products or Older") And (InStr(c, "Managed Annuity Program") = 1 Or InStr(c, "Family Income Protector") = 1) And c1.Offset(, -3) >= c.Offset(, 3) And c1.Offset(, -3) <= c.Offset(, 4) And IsEmpty(c1.Offset(, 7)) = True Then
c1.Offset(, 7) = c.Offset(, 2)
col = Sheets(c1.Offset(, 7).Value).Cells.Find(what:="Policy Number").Column
lrowdest = Sheets(c1.Offset(, 7).Value).Cells(Rows.Count, col).End(xlUp).Offset(1).Row
Range(c1.Offset(, -5), c1.Offset(, 2)).copy Sheets(c1.Offset(, 7).Value).Cells(lrowdest, col)
ElseIf (c.Offset(, 2) = "No Rider Restrictions" Or c.Offset(, 2) = "02 Products or Older") And c = "Blank" And c1 = "" And c1.Offset(, -3) >= c.Offset(, 3) And c1.Offset(, -3) <= c.Offset(, 4) And IsEmpty(c1.Offset(, 7)) = True Then
c1.Offset(, 7) = c.Offset(, 2)
col = Sheets(c1.Offset(, 7).Value).Cells.Find(what:="Policy Number").Column
lrowdest = Sheets(c1.Offset(, 7).Value).Cells(Rows.Count, col).End(xlUp).Offset(1).Row
Range(c1.Offset(, -5), c1.Offset(, 2)).copy Sheets(c1.Offset(, 7).Value).Cells(lrowdest, col)
ElseIf InStr(c1, c) > 0 And c1.Offset(, i) >= c.Offset(, 3) And c1.Offset(, i) <= c.Offset(, 4) And IsEmpty(c1.Offset(, 7)) = True Then
c1.Offset(, 7) = c.Offset(, 2)
col = Sheets(c1.Offset(, 7).Value).Cells.Find(what:="Policy Number").Column
lrowdest = Sheets(c1.Offset(, 7).Value).Cells(Rows.Count, col).End(xlUp).Offset(1).Row
Range(c1.Offset(, -5), c1.Offset(, 2)).copy Sheets(c1.Offset(, 7).Value).Cells(lrowdest, col)
End If
Next c1
Next c
If i = -3 Then
i = 0
Else
i = -3
End If
Loop
Hide
Sheets("BoB").Activate
End Sub