Hi I Have been provided a fantastic code to search for a value across multiple pages.
I'm trying to make it search for all the instances in the sheet, but I cant seem to get it.
Name Description Date Purchased
T9902C19 1 May-07
T9902C17 2 May-09
T9902C19 3 May-11
T9902C15 4 May-15
Like in the example above I would like to select the first T9902C19 and display it in a textbox and the second T9902C19 and put it in a different textbox.
Code:
Private Sub CommandButton3_Click()
Dim wks As Worksheet
Dim FoundCell As Range
For Each wks In Worksheets
Select Case wks.Name
Case "BOM-2", "BOM-3", "BOM-4" 'change/add as desired
Set FoundCell = wks.Cells.Find(what:=Me.TextBox1.Value, LookIn:=xlValues, Lookat:=xlWhole, MatchCase:=False)
If Not FoundCell Is Nothing Then
' wks.Activate
'FoundCell.Select
BOM_data.pnone.Text = FoundCell.Value
BOM_data.Descone.Text = FoundCell.Offset(0, 1).Value
BOM_data.feetone.Text = FoundCell.Offset(0, 2).Value
BOM_data.inchone.Text = FoundCell.Offset(0, 3).Value
BOM_data.materialone.Text = FoundCell.Offset(0, 4).Value
'BOM_data.Show
Exit Sub
End If
End Select
Next wks
MsgBox "Search term was not found...", vbExclamation
End Sub
Name Description Date Purchased
T9902C19 1 May-07
T9902C17 2 May-09
T9902C19 3 May-11
T9902C15 4 May-15
Like in the example above I would like to select the first T9902C19 and display it in a textbox and the second T9902C19 and put it in a different textbox.