Consulting

Results 1 to 3 of 3

Thread: Solved: text box dependent on list box in userform

  1. #1
    VBAX Mentor
    Joined
    Sep 2004
    Posts
    431
    Location

    Solved: text box dependent on list box in userform

    I have posted this @MrExcel but think I will get more help with an attachment www.mrexcel.com/forum/showthread.php?p=2265277#post2265277
    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
    Last edited by ndendrinos; 03-31-2010 at 08:55 AM.
    Thank you for your help

  2. #2
    VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    [vba]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[/vba]
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    VBAX Mentor
    Joined
    Sep 2004
    Posts
    431
    Location
    Thank you lucas ... perfect!
    Thank you for your help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •