Results 1 to 4 of 4

Can only read value from *some* listboxes

Threaded View

  1. #1
    Registered User
    Join Date
    08-27-2012
    Location
    Roma, Italia
    MS-Off Ver
    Excel 2003
    Posts
    60

    Angry Can only read value from *some* listboxes

    So I have a form that simplifies the process of entering in systematic information. The form consists of 3 listboxes, a textbox and a few buttons. It works fine if the user clicks on each listbox, and then on the "OK" button.

    I also want to provide a radiobutton that pre-populates each control (there's basically one combination that's popular, so the radiobutton saves time and maximizes consistency). All the controls get properly selected..... but I can only get values from 2 of the listboxes... one of them only gets a value if a user CLICKS on it... otherwise it keeps value=""

    No multi-select issues or complex stuff... this should be super simple... What gives?

    Probably easiest to understand if you look at the file HERE: bug.xls

    CODE BELOW:

    Option Explicit
    
    Private Sub CommandButton1_Click()
        ActiveCell.Value = _
        Left(Me.ListBox1.Value, 1) & _
        Left(Me.ListBox3.Value, 1) & _
        Left(Me.ListBox2.Value, 1) & "|" & _
        Me.TextBox1.Value
    Unload Me
    End Sub
    
    Private Sub OptionButton1_Click()
    
        Me.ListBox1.ListIndex = 2
        Me.ListBox2.ListIndex = 0
        Me.ListBox3.ListIndex = 1
        Me.TextBox1.Value = "TEST"
        Me.CommandButton1.SetFocus
    End Sub
    
    Private Sub userform_activate()
        With Me.ListBox1
            .AddItem "A1"
            .AddItem "B2"
            .AddItem "C3"
        End With
        With Me.ListBox2
            .AddItem "Y"
            .AddItem "N"
        End With
        With Me.ListBox3
            .AddItem "1 "
            .AddItem "2 "
            .AddItem "3 "
        End With
    End Sub
    Last edited by mexindian; 04-09-2013 at 06:46 AM. Reason: removing duplicate attachment

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1