+ Reply to Thread
Results 1 to 2 of 2

Listbox question

  1. #1
    Registered User
    Join Date
    02-27-2013
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    14

    Post Listbox question

    How are you!
    I got stuck when making the following macro.

    Here is a piece of the code I'm trying to use.

    If ListBox1.Selected(0) = True Then
    Call b7

    If ListBox1.Selected(1) = True Then
    Call b8

    If ListBox1.Selected(2) = True Then
    Call b9


    End If
    End If
    End If
    End Sub

    Basically I need the macro to call the appropriate Subs if the listbox items are selected.
    The trouble I'm having is that if only listbox(0) and listbox(2) are selected, only b7 is called and not b9.

    How can make VBA call whatever appropriate sub based on whichever corresponding lisbox entry is selected.

    Thank you

  2. #2
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Listbox question

    Hi,

    Use instead Select Case, that one will do the trick.


    Formula: copy to clipboard
    Please Login or Register  to view this content.


    My knowledge about VBA is not so great, this could work or maybe it has to be edited a little bit more.
    Last edited by Megatronixs; 05-10-2013 at 03:01 PM. Reason: forgot a comment

+ Reply to Thread

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