Consulting

Results 1 to 5 of 5

Thread: Solved: Listbox selection change

  1. #1
    VBAX Tutor
    Joined
    Sep 2007
    Posts
    265
    Location

    Solved: Listbox selection change

    Hi there,

    do me a favor, if I want to show a value based on listbox selection.

    For instance:
    If selection changed in listbox then we show a value in column E.

    Kindly advice

    Thank in advance and have a nice weekend.
    Rgds,
    Harto

  2. #2
    VBAX Tutor
    Joined
    Sep 2007
    Posts
    265
    Location
    Quote Originally Posted by slamet Harto
    If selection changed in listbox then we show a value in column E.
    I mean, Textbox2 is showing a value based on column E

    Example:
    listbox selection row 1 is
    10.1MD0

    then textbox to is A

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    I have never seen anyone call a listbox TextBox2 before!

    [vba]

    Private Sub ListBox1_Click()
    With Me

    If .ListBox1.ListIndex >= 0 Then _
    .Textbox2.Clear
    .Textbox2.AddItem .ListBox1.List(.ListBox1.ListIndex, 3)
    End With
    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  4. #4
    VBAX Tutor
    Joined
    Sep 2007
    Posts
    265
    Location
    Hi Bob

    Its work fine and will change textbox to another listbox.
    Thank you for assistance.

    Best rgds,
    harto

  5. #5
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    [VBA]Private Sub ListBox1_Change()
    With Me
    .TextBox2.Text = .ListBox1.Text
    End With
    End Sub[/VBA]

Posting Permissions

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