View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz[_2_] JLGWhiz[_2_] is offline
external usenet poster
 
Posts: 1,565
Default Populate TextBox with Change Event

Here is one way:

Private Sub TextBox1_Change()
Dim myTxt As String
myTxt = Me.TextBox1.Text
If Me.TextBox1.Text < "" And IsNumeric(myTxt) Then
Me.TextBox2.Text = ActiveSheet.Range("B" & myTxt).Value
End If
End Sub

Copy code to UserForm code module


"Johnny" wrote in message
...
I have a form with two textboxes. TextBox1 is the row # that contains
specific data in that row in column B that I would like to appear in
TextBox2. So, everytime I change TextBox1 I would like TextBox2 to
change.
I need help writing the change event code to select the range with the
variable row number in TextBox1.

For example, if I change TextBox1 to "3", TextBox2 should populate with
data
that's located in Range B3 from the sheet.

Thank you