Select Case OptionPicked
Case "Option1"
' code to return data less/earlier than '15:00'
Cate "Option2"
' code to return if more/later than or equal to '15:00'
End Select
With ws1.Range("M3:M" & lngLastRow)
Set rng = .Find("No", LookIn:=xlValues)
If Not rng Is Nothing Then
rng1 = rng.Address
Do
ws2.Range("B1").Value = Format(Date, "dd/mm/yyyy")
ws2.Range("D1").Value = cbo1.Value & " Handover"
ws2.Range("B55").Value = Format(Date, "dd/mm/yyyy")
ws2.Range("D55").Value = cbo1.Value & " Handover"
If rng.Offset(0, -6) = "Option1" Then
If rng.Offset(, 6) = STE Then
ws2.Range("A60").Offset(findoffset, 0).Value = rng.Offset(, -10) & " " & rng.Offset(, -9)
ws2.Range("D60").Offset(findoffset, 0).Value = rng.Offset(, -11) ws2.Range("G60").Offset(findoffset, 0).Value = rng.Offset(, -5)
findoffset = findoffset + 1
End If
End If
Set rng .FindNext(rng)
Loop While Not rng Is Nothing And rng.Address <>rng1
End If
Set rngresolved = .Find("Yes", LookIn:=xlValues)
If Not rngresolved Is Nothing Then
rngresolved1 = rngresolved.Address
Do
If cboShift.Value = "AM" Then
If (Format(CDate(rngresolved.Offset(, -8)), "dd/mm/yyyy") = Format(Date, "dd/mm/yyyy") _
And Format(rngresolved.Offset(, -7), "hh:mm") < Format("15:00", "hh:mm")) _
Or (Format(CDate(rngresolved.Offset(, -8)), "dd/mm/yyyy") < Format(Date, "dd/mm/yyyy") - 1 _
And Format(rngresolved.Offset(, -7), "hh:mm") >= Format("15:00", "hh:mm")) Then
If rngresolved.Offset(,6) = "Option1" Then
'etc