Yep.
If there is a key column (say column A) on Sheet1 that contains that value, you
could use something like this.
This takes the value in Textbox1 of the userform, and matches it against column
A of Sheet1.
If there's a match, then it puts the value in column B into textbox2 of the
userform. If there's no match, it puts a warning message into textbox2.
Option Explicit
Private Sub CommandButton1_Click()
Dim res As Variant
Dim wks As Worksheet
Dim IDNumber As Long
If IsNumeric(Me.TextBox1.Value) = False Then
MsgBox "Please enter an ID!"
Exit Sub
End If
Set wks = Worksheets("sheet1")
IDNumber = CLng(Me.TextBox1.Value)
With wks
res = Application.Match(IDNumber, .Range("A:a"), 0)
If IsError(res) Then
'no match found, what should happen
Else
'put the value from column B into textbox2 of the userform
Me.TextBox2.Value = .Range("a:a")(res).Offset(0, 1).Value
End If
End With
End Sub
I'm kind of confused about if you wanted to populate a userform or plop data
into another worksheet, but this line could change pretty easily:
Me.TextBox2.Value = .Range("a:a")(res).Offset(0, 1)
to
worksheets("OtherSheetNameHere").range("x99").value _
=.Range("a:a")(res).Offset(0, 1).Value
If you wanted to plop the value into another worksheet.