View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Die_Another_Day Die_Another_Day is offline
external usenet poster
 
Posts: 644
Default Dynamic forms in a macro userform

TextBox2.Value = c.Offset(,1).Value

HTH

Charles Chickering
Sjakkie wrote:
At the moment i am trying to dynamically type out a form.
By inputting the id of a user in textbox1 it looks in a1 to a2000 for the id.
So say the value of a16 is returned, i want it to be able to write the value
of b16 in textbox2. the same as if a256 was given b256 would be dynamically
input in textbox2.
Any idea on how i could do this.


Private Sub TextBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
With Worksheets("customer details").Range("a1:a2000")
Set c = .Find(UserForm1.TextBox1.Value, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
TextBox2.Value = c.value
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With

End Sub