+ Reply to Thread
Results 1 to 6 of 6

Get Drop Down ComboBox Text Value VBA

  1. #1
    Registered User
    Join Date
    06-19-2013
    Location
    Peoria, IL
    MS-Off Ver
    Excel 2010
    Posts
    18

    Get Drop Down ComboBox Text Value VBA

    When I use this code it works
    Sub DropDown11_Change()
    'Insert Selection into fac
    With ActiveSheet.Shapes("Drop Down 11").ControlFormat
    MsgBox "Item chosen = " & .List(.Value)
    End With

    But I would like to set my fac= the value of what the msg box comes up with but this doesn't work:

    Dim fac As String

    ActiveSheet.Shapes("Drop Down 11").Select
    fac = ActiveSheet.Shapes("Drop Down 11").ControlFormat.Value
    It comes up as another value "1/2/3" instead of "NN/KK" which is the text in the drop down menu

    What should I change?

  2. #2
    Forum Contributor
    Join Date
    04-26-2013
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    167

    Re: Get Drop Down ComboBox Text Value VBA

    fac = ActiveSheet.Shapes("Drop Down 11").ControlFormat.Value

    try

    fac = ActiveSheet.Shapes("Drop Down 11").ControlFormat.text
    or
    fac = ActiveSheet.Shapes("Drop Down 11").ControlFormat.string

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Get Drop Down ComboBox Text Value VBA

    Do you have any other drodowns in the workbook?
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    06-19-2013
    Location
    Peoria, IL
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Get Drop Down ComboBox Text Value VBA

    It still comes up as '7' instead of the facility name selected.

  5. #5
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Get Drop Down ComboBox Text Value VBA

    I don't see the problem. Maybe you should attach an example file?

    As Norie said, you may have reassigned the macro if you added another form control ComboBox.

    Please Login or Register  to view this content.
    Last edited by Kenneth Hobson; 07-11-2013 at 10:19 AM.

  6. #6
    Registered User
    Join Date
    06-19-2013
    Location
    Peoria, IL
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Get Drop Down ComboBox Text Value VBA

    With ActiveSheet.Shapes("Drop Down 13").ControlFormat
    bldg = .List(.Value)

    this worked! if you don't want the msg box

+ 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