السلام عليكم
جرب هذا التعديل
Sub Solaf()
Dim LastRow As Long, i As Long, ii As Long
Dim SText As String
Dim SText1 As String
Dim StDate As Date, EndDate As Date
With Sheets("السلف")
.Range("A7:L10000").ClearContents
SText = .Range("B2")
SText1 = .Range("C2")
StDate = .Range("B3")
EndDate = .Range("B4")
End With
ii = 7
With Sheets("yaomea")
LastRow = .Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To LastRow
If CStr(.Cells(i, "J")) = SText Then
If SText1 = "" Then GoTo 1
If CStr(.Cells(i, "N")) = SText1 Then
1
Select Case .Cells(i, "d").Value2: Case StDate To EndDate
Sheets("السلف").Cells(ii, "A").Resize(1, 12).Value = .Cells(i, "A").Resize(1, 12).Value
ii = ii + 1
End Select
End If
End If
Next
End With
End Sub