Search?

  • Thread starter Thread starter Seedubs
  • Start date Start date
S

Seedubs

Hello all,


I have a user form with 3 text boxes in it, I wish to be able to ente
a value into all three boxes and then assigned to a command button b
able to find the first value in Textbox 1 on a separate worksheet an
then once it has found that value, write to the next two cells (on tha
row) with the data entered into textbox 2 and 3?

Could a VLookup do this? Or is there an easier way to achieve this?

Many thanks

Dubs
 
One way:

Private Sub CommandButton1_Click()
Dim rfound As Range
Set rfound = Sheets("Sheet2").Cells.Find( _
What:=TextBox1.Text, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
MatchCase:=False)
If Not rfound Is Nothing Then
With rfound
.Offset(0, 1).Value = TextBox2.Text
.Offset(0, 2).Value = TextBox3.Text
End With
End If
End Sub
 
Back
Top