Your post is rather confusing. Try this:
Sub RunMe()
Dim ws As Worksheet: Set ws = Sheets("Data")
Dim wksht As Worksheet
Dim LR As Long, icell As Long
Dim iMatch As Boolean
LR = ws.Range("D" & Rows.Count).End(xlUp).Row
For icell = 2 To LR
iMatch = False
If ws.Range("D" & icell).Value = "prepare" Then
For Each wksht In Worksheets
If Not wksht.Name = "Data" Then
If ws.Range("F" & icell).Value = wksht.Range("B3").Value Then
iMatch = True
If ws.Range("E" & icell).Value - wksht.Range("C3").Value < 4 Then 'yes it found it and now check date differnce
ws.Range("A" & icell).Resize(1, 4).Copy Destination:=wksht.Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
End If
End If
'no matching desk number? Find by date? Not sure what OP meant
'If iMatch = False Then
'End If
End If
Next wksht
End If
Next icell
End Sub
Bookmarks