GhostofDoom
12-18-2019, 08:55 PM
Hello,
i have convert it to a table
and now i want to search for a string
this code i use only shows the match but how can i search anything if it contains it
With ListBox1
.List = Sheets("TestSheet").ListObjects(1).DataBodyRange.Value
For j = .ListCount - 1 To 0 Step -1
If cboSelect.Value = "FirstName" Then
If .List(j, 0) <> txtSearch.Text Then .RemoveItem j ' shows only the exact match (Mattijs) not (matt)
End If
If txtSearch.Value = "" Then
If .List(j, 0) <= "" Then .RemoveItem j 'shows everything if txtSearch is empty
End If
Next j
End With
i search for ma but nothing happens
if i use Ma then it show any records
if i use this
With ListBox1
.List = Sheets("TestSheet").ListObjects(1).DataBodyRange.Value
For j = .ListCount - 1 To 0 Step -1
If cboSelect.Value = "FirstName" Then
If .List(j, 0) <= txtSearch.Text Then .RemoveItem j ' shows only if start with 'M' or 'Ma' match not 'm' or 'ma'
End If
If txtSearch.Value = "" Then
If .List(j, 0) <= "" Then .RemoveItem j 'shows everything if txtSearch is empty
End If
Next j
End With
Thanks
i have convert it to a table
and now i want to search for a string
this code i use only shows the match but how can i search anything if it contains it
With ListBox1
.List = Sheets("TestSheet").ListObjects(1).DataBodyRange.Value
For j = .ListCount - 1 To 0 Step -1
If cboSelect.Value = "FirstName" Then
If .List(j, 0) <> txtSearch.Text Then .RemoveItem j ' shows only the exact match (Mattijs) not (matt)
End If
If txtSearch.Value = "" Then
If .List(j, 0) <= "" Then .RemoveItem j 'shows everything if txtSearch is empty
End If
Next j
End With
i search for ma but nothing happens
if i use Ma then it show any records
if i use this
With ListBox1
.List = Sheets("TestSheet").ListObjects(1).DataBodyRange.Value
For j = .ListCount - 1 To 0 Step -1
If cboSelect.Value = "FirstName" Then
If .List(j, 0) <= txtSearch.Text Then .RemoveItem j ' shows only if start with 'M' or 'Ma' match not 'm' or 'ma'
End If
If txtSearch.Value = "" Then
If .List(j, 0) <= "" Then .RemoveItem j 'shows everything if txtSearch is empty
End If
Next j
End With
Thanks