+ Reply to Thread
Results 1 to 3 of 3

How To retrieve selected item value from Excel DropDown List using VBA

  1. #1
    Registered User
    Join Date
    10-24-2005
    Posts
    8

    How To retrieve selected item value from Excel DropDown List using VBA

    I use the following code

    >>Sub TestA()
    >>With Worksheets(1)
    >>Set k = .Shapes.AddFormControl(xlListBox, 100, 10, 100, 100)
    >> For x = 1 To 10
    >> k.ControlFormat.AddItem "test" & x
    >> Next
    >>End With
    >>End Sub

    >>Sub TestB()
    >>MsgBox "Hello"
    >>End Sub

    First run the procedure "TestA" which creates a drop dawn list (test1, test2, ...,test10) in work sheet(1).
    After macro "TestB" assigned (Right click >Assign macro >TestB) to the drop down list.
    Thus when i select an item from the drop down list i have the message "Hello"


    I need help (the key words that i have to use) in order to add code that each time i select a item from the dropdown list, the value that i select (e.g "test2") to be returned with the MsgBox.

    Many thanks

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: How To retrieve selected item value from Excel DropDown List using VBA

    You can use:
    Please Login or Register  to view this content.
    Remember what the dormouse said
    Feed your head

  3. #3
    Registered User
    Join Date
    10-24-2005
    Posts
    8

    Re: How To retrieve selected item value from Excel DropDown List using VBA

    Many thanks to Romperstomper
    my problem solved
    appriciate

+ 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