Excel User form

zezo2021

Member
Local time
Today, 22:16
Joined
Mar 25, 2021
Messages
412
friends
I'm using this code to search in a specific column in sheet

My problem is:
- Search is Case Sensitive
- I want to search with any part of the word, not from the start

Code:
Dim LastRow As Integer
LastRow = Worksheets("Database").Cells(Rows.Count, 2).End(xlUp).Row
Dim i As Integer
i = 0

For Each C In Worksheets("Data").Range("B2:B" & LastRow)
        If C Like txtSearch.Value & "*" Then

        End If
Next C
 
Code:
Dim LastRow As Integer
LastRow = Worksheets("Database").Cells(Rows.Count, 2).End(xlUp).Row
Dim i As Integer
Dim C As Range
i = 0

For Each C In Worksheets("Data").Range("B2:B" & LastRow)
        If C.Value & "" Like "*" txtSearch.Value & "*" Then

        End If
Next C
 
Code:
Dim LastRow As Integer
LastRow = Worksheets("Database").Cells(Rows.Count, 2).End(xlUp).Row
Dim i As Integer
Dim C As Range
i = 0

For Each C In Worksheets("Data").Range("B2:B" & LastRow)
        If C.Value & "" Like "*" txtSearch.Value & "*" Then

        End If
Next C
is there & before textSearch

error and stop on txtSearch
 
ooopps, yes there is.

If C.Value & "" Like "*" & txtSearch.Value & "*" Then
 
Sorry
worked
But if the sentence begin with Capital Must Type Capital
 
If InStr(1, C.Value & "", txtSearch.Value, vbBinaryCompare) <> 0 Then

End If
 

Users who are viewing this thread

Back
Top Bottom