Artisez
Member
I am using the following code for a command button to find text in a text box. Is there a code or an edit to the next text? I use a spreadsheet that may have a word listed multiple times. The current code stops at the first text found, I need a way to go to the next text.
Any help would be greatly appreciated
Code:
Private Sub CommandButton2_Click()
Dim ws As Worksheet
Dim FindString As String
Dim Rng As Range
Set ws = ThisWorkbook.Worksheets("Data")
FindString = TextBox1.Value
If Trim(FindString) <> "" Then
Set Rng = ws.Cells.Find( _
What:=FindString, _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
If Not Rng Is Nothing Then
Application.Goto Rng, True
Else
MsgBox "Nothing found"
End If
End If
End Sub
Any help would be greatly appreciated