PDA

View Full Version : Solved: text box dependent on list box in userform



ndendrinos
03-31-2010, 07:35 AM
I have posted this @MrExcel but think I will get more help with an attachment www.mrexcel.com/forum/showthread.php?p=2265277#post2265277 (http://<a href=)
I find it difficult to explain my problem but the attachment is well documented ... maybe you can have a look

Tried but does not work:

Private Sub ListBox1_Click()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Dim Rng As Range

If TextBox1.Value <> "" Then
Set Rng = Workbooks("test.xls").Worksheets("Authors").Columns(2).Find(ListBox1.Value)
If Not Rng Is Nothing Then
TextBox1.Value = Rng.Offset(0, 3).Value

End If

End If
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub

lucas
03-31-2010, 12:34 PM
Private Sub ListBox1_Click()
Dim Rng As Range
Set Rng = Workbooks("test.xls").Worksheets("Authors").Columns(2).Find(ListBox1.Value)
If Not Rng Is Nothing Then
TextBox1.Value = Rng.Offset(0, 1).Value
End If
End Sub

ndendrinos
03-31-2010, 01:17 PM
Thank you lucas ... perfect!