السلام عليكم
بالنسبة لهذا الطلب
غير كود زر البحث في الفورم بهذا
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 = 11 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("k2").Resize(LastRow)): Me.TextDate1 = Format(dt1, DateFormt)
If IsDate(Me.TextDate2) Then dt2 = DateValue(Me.TextDate2) Else dt2 = WorksheetFunction.Max(.Range("k2").Resize(LastRow)): Me.TextDate2 = Format(dt2, DateFormt)
End With
'-------------------------
sColmn = ""
With sRng
For R = 2 To LastRow
Select Case .Cells(R, 11).Value2: Case dt1 To dt2
ib = CStr(.Cells(R, MyColmnFind)) = CStr(Me.TextFind)
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
End Sub
تحياتي