السلام عليكم
' عدد الاعمدة
Private Const Cont As Integer = 2
Sub kh_Find()
Dim Ary()
Dim i As Long, ii As Long, Lr As Long
Dim dt1 As Double, dt2 As Double
Dim txt As String
Lr = Cells(Rows.Count, "H").End(xlUp).Row
If Lr > 4 Then Range("H5:I" & Lr).ClearContents
On Error GoTo 1
txt = [H3]
dt1 = [I3]
dt2 = [J3]
With ورقة1
Lr = .Cells(.Rows.Count, "a").End(xlUp).Row
For i = 2 To Lr
Select Case .Cells(i, "B").Value2: Case dt1 To dt2
If InStr(CStr(.Cells(i, "A")), txt) Then
ii = ii + 1
ReDim Preserve Ary(1 To Cont, 1 To ii)
Ary(1, ii) = .Cells(i, "C").Value
Ary(2, ii) = .Cells(i, "D").Value
End If
End Select
Next
End With
If ii Then Range("H5").Resize(ii, Cont).Value = WorksheetFunction.Transpose(Ary)
1
Erase Ary
End Sub
المرفق 2010
بحث وسرد.rar