السلام عليكم
اضغط مرتين على زر البحث الموجود في الفورم ستجد كود
قم بحذفه و استبدله بالكود التالي :
Private Sub ButtonFind_Click()
Dim MyValue
Dim MyAr() As String
Dim ib As Boolean
Dim R As Integer, i As Integer, ii As Integer
Dim MyColmnFind As Integer, LastRow As Integer
Dim dt1 As Date, dt2 As Date
MyColmnFind = Me.ComboFind.ListIndex + 1
If MyColmnFind = 0 Then Exit Sub
If MyColmnFind = 3 Then Me.TextFind = ""
Me.ListFind.Clear
With sRng.Worksheet
LastRow = .Range("A65536").End(xlUp).Row
If IsDate(Me.TextDate1) Then dt1 = DateValue(Me.TextDate1) Else dt1 = WorksheetFunction.Min(.Range("C2").Resize(LastRow)): Me.TextDate1 = Format(dt1, DateFormt)
If IsDate(Me.TextDate2) Then dt2 = DateValue(Me.TextDate2) Else dt2 = WorksheetFunction.Max(.Range("C2").Resize(LastRow)): Me.TextDate2 = Format(dt2, DateFormt)
End With
sColmn = ""
With sRng
For R = 2 To LastRow
Select Case .Cells(R, 3).Value2: Case dt1 To dt2
ib = InStr(1, .Cells(R, MyColmnFind), Me.TextFind, vbTextCompare) = 1
If ib Then
sColmn = sColmn & R & " "
ii = ii + 1
ReDim Preserve MyAr(1 To ContColmn, 1 To ii)
For i = 1 To ContColmn
If IsDate(.Cells(R, i)) Then MyValue = Format(.Cells(R, i).Value2, DateFormt) _
Else: MyValue = .Cells(R, i).Value2
MyAr(i, ii) = MyValue
Next
End If
End Select
Next
End With
If ii Then Me.ListFind.Column = MyAr: Me.ListFind.ListIndex = 0
For s = 0 To ListFind.ListCount
ListFind.ListIndex = s - 1
If s Then
ListFind.Column(3) = Format(ListFind.Column(3), "hh:mm AM/PM")
End If
Next
End Sub