Results 1 to 5 of 5

ListBox - Form vs ActiveX

Threaded View

  1. #1
    Registered User
    Join Date
    12-21-2010
    Location
    Virginia
    MS-Off Ver
    Excel 2003
    Posts
    5

    ListBox - Form vs ActiveX

    I have a dilemma - I need a list box that outputs the number of its selection, and can be toggled visible/not visible.

    The Form Control ListBox outputs the number of the option selected (In a list of states, selecting "Alaska" returns "2"). However, I cannot seem to make my CommandButton toggle its visibility.

    The ActiveX Control ListBox outputs the selection itself (Selecting Alaska returns"Alaska") and I cannot seem to run formulas based on it (=(A1="Alaska") returns FALSE instead of TRUE). I can, however, toggle its visibility with a command button:

    Private Sub CommandButton1_Click()
        
        If CommandButton1.Caption = "By State" Then
            StateList.Visible = True
            CommandButton1.Caption = "Country Wide"
        ElseIf CommandButton1.Caption = "Country Wide" Then
            StateList.Visible = False
            CommandButton1.Caption = "By State"
        End If
    
    End Sub
    I tried that code with a Form ListBox (I determined its name by assigning it a macro). "ListBox3.Visible = True" results in an error: Run-time error '424': Object required.

    So - I need one of the following (although learning them all is always awesome, too):

    - A way to make my ActiveX control output the number of its selection

    - A formula that can take the ActiveX selection into account (a boolean on the "State" selected)

    - Or a way to modify my above code to toggle the visibility of a Form ListBox

    Thoughts?
    Last edited by Roseus; 12-29-2010 at 12:09 PM.

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