ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,832
- Office Version
- 2007
- Platform
- Windows
Hi,
I have a userform which will search for my value in TextBox1.
The search finds the first value BUT its not the one i require.
On my userform i have a command button which i hope to press so the search will just continue & look for the next value.
Please advise code to place on command button.
This is what i have so far.
I have a userform which will search for my value in TextBox1.
The search finds the first value BUT its not the one i require.
On my userform i have a command button which i hope to press so the search will just continue & look for the next value.
Please advise code to place on command button.
This is what i have so far.
Rich (BB code):
Private Sub ClearSearchField_Click()
TextBox1.Value = ""
TextBox1.SetFocus
End Sub
Private Sub CloseForm_Click()
Unload DatabaseSearch
End Sub
Private Sub ContinueSearch_Click()
End Sub
Private Sub FindTheValue_Click()
Dim ws As Worksheet
Dim Rng As Range
Set ws = Sheets("DATABASE") ' CHANGE SHEET NAME TO SUIT
Set Rng = ws.Range("A5:AB3000").Find(Me.TextBox1.Value) ' RANGE TO LOOK IN & TEXTBOX NAME FOR WHAT TO LOOK FOR
If Not Rng Is Nothing Then
ws.Activate
Rng.Select
Else
MsgBox "NOTHING TO MATCH THE SEARCH VALUE", vbCritical, "VALUE NOT FOUND MESSAGE"
Exit Sub
End If
End Sub
Private Sub TextBox1_Change()
TextBox1 = UCase(TextBox1)
End Sub
Private Sub UserForm_Initialize()
Me.StartUpPosition = 0
Me.Top = Application.Top + 135 ' MARGIN FROM TOP OF SCREEN
Me.Left = Application.Left + Application.Width - Me.Width - 400 ' LEFT / RIGHT OF SCREEN
End Sub