+ Reply to Thread
Results 1 to 6 of 6

ActiveX ComboBox on Spreadsheet

  1. #1
    Registered User
    Join Date
    11-29-2008
    Location
    Houston
    MS-Off Ver
    Office 2003, and 2007
    Posts
    77

    ActiveX ComboBox on Spreadsheet

    How do I populate a ComboBox on a spreadsheet??

    I have this table on the spreadsheet but would rather populate the box from the macro. I've tried the following, as well as a few others but it's not working.


    Please Login or Register  to view this content.
    Regards,
    Dan
    Real world knowledge isn't dropped from a parachute in the sky but rather acquired in tiny increments from a variety of sources including panic and curiosity.

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

    Re: ActiveX ComboBox on Spreadsheet

    Try this, it goes into the same module as your combobox because it is a worksheet activated code
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-29-2008
    Location
    Houston
    MS-Off Ver
    Office 2003, and 2007
    Posts
    77

    Re: ActiveX ComboBox on Spreadsheet

    Dave,
    Thanks for the help!!!
    Another question however...How do I set a variable based on what the user had selected?

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

    Re: ActiveX ComboBox on Spreadsheet

    All sorts of things can be done with it.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-29-2008
    Location
    Houston
    MS-Off Ver
    Office 2003, and 2007
    Posts
    77

    Re: ActiveX ComboBox on Spreadsheet

    Thanks again Dave,
    What i'm trying to do with the ComboBox, is use it in conjunction with an OptionButton used to set the spreadsheet to either SI units or US Standard units. If OptionButton1 is selected than its "SI units", if OptionButton2, than its "US Units"

    When the user selects an item from the ComboBox, two variables are set based on SI Units or US Units.

    - User selects the 1st item in the ComboBox.
    - If OptionButton1 is set, Than Variable "SpecG" is set to...say...100 and "SpecT" is set to 200.
    - If OptionButton 2 is set, than is't 300 and 400 respectively.

    - User selects the 4th item in the ComboBox, that it's 104, 204, or 304, 404.

    I'm going to use this variable in another calculation so i'm assuming the variable would need to be an "Integer"???

  6. #6
    Registered User
    Join Date
    01-12-2010
    Location
    New Mexico, USA
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: ActiveX ComboBox on Spreadsheet

    Quote Originally Posted by davesexcel View Post
    Try this, it goes into the same module as your combobox because it is a worksheet activated code
    Please Login or Register  to view this content.
    Just a note to anyone who is interested. I used
    Please Login or Register  to view this content.
    to define my Combo Box list and ran into an interesting problem. I was using the Combo Box to run a macro depending on what option I selected. The problem I ran into was that any time I clicked anywhere on the sheet, it re-ran the macro code for the option selected in the combo box. I tweaked it a little, to this:
    Please Login or Register  to view this content.
    and this seemed to fix the problem. It only triggered when I changed the selection in the combo box. If you don't have actions tied to the selections you probably won't see anything odd happening, but it may just make things in general run more smoothly with the tweak.

+ 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