kelly mort
Well-known Member
- Joined
- Apr 10, 2017
- Messages
- 2,169
- Office Version
- 2016
- Platform
- Windows
HelloWorld,
I have being struggling with this for a while now.
Say I have this data in my database :
01-02-03-04-05
I can use a textbox input to lookup say 03-04
That is when the numbers follow each other.
Now I am trying to get a script that can take the input of say 02-05 from my textbox and still find this 01-02-03-04-05 from the database.
That is I am looking for a script that can take the textbox input and find if those numbers are found in an entry.
Thanks in advance
Below is the code I have now:
I have being struggling with this for a while now.
Say I have this data in my database :
01-02-03-04-05
I can use a textbox input to lookup say 03-04
That is when the numbers follow each other.
Now I am trying to get a script that can take the input of say 02-05 from my textbox and still find this 01-02-03-04-05 from the database.
That is I am looking for a script that can take the textbox input and find if those numbers are found in an entry.
Thanks in advance
Below is the code I have now:
Code:
[/COLOR]Sub Lookup()
Me.lstView.ColumnCount = 6
Dim myArray As Variant
myArray = [c7].Resize(, Me.lstView.ColumnCount + 1).Value
Me.lstView.List = myArray
Me.lstView.Clear
term = Me.CmbClass.Value
With Sheets(term).Range("C7:C1007")
Set rngFind = .Find(what:=Me.Rw2.Text, After:=Sheets(term).[C1007], LookIn:=xlValues, lookat:=xlWhole, SearchDirection:=xlNext)
If Not rngFind Is Nothing Then
strFirstFind = rngFind.Address
Do
If rngFind.Row > 1 Then
Me.lstView.AddItem rngFind.Offset(0, -1).Text
For i = 1 To 5
Me.lstView.List(Me.lstView.ListCount - 1, i) = rngFind.Offset(0, i - 1).Text
Next i
End If
Set rngFind = .FindNext(rngFind)
Loop While Not rngFind Is Nothing And rngFind.Address <> strFirstFind
End If
End With
End Sub
[COLOR=#333333]
Last edited: