I have a bit problem when searching name(combobox1) with square branket "[]": For example "Peter[Jones]" ,which couldn't show in listbox when searching.
How to fix this problem.
Anyone can help or suggest
Dim a, LngIndex As Long Dim ytCrit, mtCrit, dtCrit As Long Dim yuCrit, muCrit, duCrit As Long Dim sCrit As String Dim tCrit, uCrit As Date Dim vCrit, wCrit As Long Dim tngSource As Range Dim LastRow As Long LastRow = Worksheets("Sheet2").Cells(Cells.Rows.Count, "K").End(xlUp).Row On Error Resume Next Set tngSource = Worksheets("Sheet2").Range("A2:K" & LastRow) With Me.ListBox1 .ColumnCount = 11 .ColumnWidths = "80;80;80;0;0;110;150;0;80;80;80;" .List = tngSource.Cells.Value ' date format For LngIndex = o To .ListCount - 1 .List(LngIndex, 6) = UCase(Format(CDate(.List(LngIndex, 6)), "dd/mm/yyyy")) Next LngIndex End With On Error Resume Next '1.name If ComboBox1.Value <> "" Then sCrit = "*" & UCase(Me.ComboBox1) & "*" With Me.ListBox1 For a = .ListCount - 1 To 0 Step -1 If Not UCase(.List(a, 1)) Like sCrit Then .RemoveItem a End If Next a End With End If




Reply With Quote