+ Reply to Thread
Results 1 to 5 of 5

Create drop down menu using ActiveX comboBox

Hybrid View

  1. #1
    Registered User
    Join Date
    02-14-2017
    Location
    Asheville, NC
    MS-Off Ver
    Excel 2013
    Posts
    4

    Create drop down menu using ActiveX comboBox

    Hello, I am new here, please be kind! I am trying to create a drop down menu that will fire different macros based on the selection from the ComboBox. I have been successful using form control ComboBox, but for flexibility I'd like to do this with an ActiveX ComboBox. I've attached (I hope!) a sample file. The macros work fine independently, but I get a "Object doesn't support this property or method" error when the "change" macro hits the "case" syntax... Any and all help would be greatly appreciated!
    Attached Files Attached Files

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,486

    Re: Create drop down menu using ActiveX comboBox

    Possibly .listindex,
    Starts at 0

    Sub ComboBox1_Change()
    'Dim c
        c = Me.ComboBox1.ListIndex
        '.ListIndex = 0
        'Choose which macro to run based on the selected value in the combobox
        MsgBox c
        Select Case c
        Case 0: ByDate
        Case 1: ByStatus
        Case 2: Macro3
        End Select
    End Sub

  3. #3
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Create drop down menu using ActiveX comboBox

    Try this:-
    NB:- the subs must be in a basic Module NOT sheet module.
    NB:- Make sure you have the identical spelling
    Sub ComboBox1_Change()
       Application.Run ComboBox1.Value
    End Sub
    Sub Index_By_Date()
    MsgBox "Index By Date"
    End Sub
    
    Sub Index_By_Status()
    MsgBox "Index by status"
    End Sub
    Sub Macro3()
    MsgBox "Macro3"
    End Sub

  4. #4
    Registered User
    Join Date
    02-14-2017
    Location
    Asheville, NC
    MS-Off Ver
    Excel 2013
    Posts
    4

    Re: Create drop down menu using ActiveX comboBox

    Davesexcel, this solution worked great! Thanks so much for a timely and elegant solution...
    Captain Flash

  5. #5
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: Create drop down menu using ActiveX comboBox

    Sub ComboBox1_Change()
    
    Select Case ComboBox
        Case "Index By Date"
            ByDate
        Case "Index By Status"
            ByStatus
        Case "Macro3"
        
        Case Else
            MsgBox "Not Defined"
    End Select
    
    End Sub
    David
    (*) Reputation points appreciated.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Tab into combobox with autocomplete drop down menu
    By jparry85 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-29-2016, 04:54 PM
  2. [SOLVED] Dynamic ComboBox (Drop down) menu in a VBA UserForm
    By igormigor in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-17-2015, 05:07 AM
  3. [SOLVED] fill listbox (ActiveX) based combobox (ActiveX)
    By elsg in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-31-2014, 11:25 AM
  4. How to create a drop down menu/box
    By Onesock in forum Excel General
    Replies: 4
    Last Post: 10-27-2012, 07:06 AM
  5. [SOLVED] I cant work out how to create a drop down menu that relates to another drop down menu
    By louise2613 in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 08-18-2012, 01:49 PM
  6. [SOLVED] Drop down menu-Can I create a drop down menu
    By murph in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-21-2006, 10:25 PM
  7. Ho Do I create drop down menu?
    By Lu Roe in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-28-2005, 10:06 AM

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