+ Reply to Thread
Results 1 to 16 of 16

Only Allow 1 Combo Box To Be Fill

  1. #1
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    440

    Only Allow 1 Combo Box To Be Fill

    Hi,

    I wonder if there is any way to only allow 1 combo box to be fill?
    I have 5 combo box,:
    cmbRef, cmbName, cmbId, cmbProfession, cmbSalary and a command button as object in worksheet.

    By pressing the command button, if only 1 combo box is filled, it will messagebox "Good". If more than 1 is filled, it will messsage box "Only 1 allowed".

    Thanks.

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Only Allow 1 Combo Box To Be Fill

    Hi calvinle

    Perhaps something like this (untested)
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    440

    Re: Only Allow 1 Combo Box To Be Fill

    This code works on Userform, but my combo box are not on userform. They are on the Worksheet itself.

    Thanks.

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Only Allow 1 Combo Box To Be Fill

    Hi calvinle

    This code works on Userform, but my combo box are not on userform. They are on the Worksheet itself.
    Well...please attach a sample file that represents what you have. The structure of your attachment should be the same structure as your actual data. Any proprietary information should be changed.

    Include in the attachment any code you're currently using (whether it works or not) and, if appropriate, an "After" worksheet that demonstrates what you wish the output to be.

    To Attach a File:

    1. Click on Go Advanced
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the "Add Files"... button to locate your file for uploading.
    6. This will open a new window File Upload...Click "Select Files"
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the "Upload Files" button and wait until the file has uploaded.
    10. Click the "Done" Button.

  5. #5
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    440

    Re: Only Allow 1 Combo Box To Be Fill

    Hi,

    Thanks for helping.

    THere you go:

    Single ComboBox.xlsm

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Only Allow 1 Combo Box To Be Fill

    Hi calvinle

    I've admired Chandoo's work. Attach yours...

  7. #7
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    440

    Re: Only Allow 1 Combo Box To Be Fill

    Hi,

    I am using their just to test out the code. That is why I left their name for their credit. Their sample file uses mysql to build the database which i don't need as I want to learn the way to solve my question of this topic. Also, as for Chandoo, they allow us to use their sample and mod it to fit our requirement as long we give them their credit, in which I did.
    I am using theirs as for learning purpose only.

    Let me know if you really need mine as I will need to remove all secure content on it.

    Thanks.

  8. #8
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Only Allow 1 Combo Box To Be Fill

    maybe so
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    440

    Re: Only Allow 1 Combo Box To Be Fill

    Hi,
    It's not working..

    Thanks.

  10. #10
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Only Allow 1 Combo Box To Be Fill

    Hi calvinle

    I'm not criticizing you for using Chandoo. The Workbook you attached, I would guess, is not of the same structure as your Workbook. That's why I asked for this
    attach a sample file that represents what you have. The structure of your attachment should be the same structure as your actual data. Any proprietary information should be changed.

  11. #11
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    440

    Re: Only Allow 1 Combo Box To Be Fill

    Hi,

    Here is the structure of my work: I remove all the data from it.

    Database.xlsm


    Thank you.

  12. #12
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Only Allow 1 Combo Box To Be Fill

    Hi calvinle

    You have 8 Combo Boxes in the Worksheet. Only two are named like this
    cmbRef, cmbName, cmbId, cmbProfession, cmbSalary
    ComboBoxes.jpg

    And of course, other than the fact that the Combo Boxes are miss-identified, we can't test because there's no Data in the Workbook. So, what is it you'd like us to do?

  13. #13
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    440

    Re: Only Allow 1 Combo Box To Be Fill

    The cmb was an exemple. Since you asked me to provide the real example, then the cbo is te real name.
    My request for only allow 1 cbo to have value by clicking on the button is for validation.
    That code will stand at first of the cmdSearchData, then if that pass, it will continu with my Searching Code.

  14. #14
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Only Allow 1 Combo Box To Be Fill

    Hi calvinle

    Try this Code for the Search Button
    Please Login or Register  to view this content.
    Attached Files Attached Files

  15. #15
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    440

    Re: Only Allow 1 Combo Box To Be Fill

    Greatly appreciated! Thank you very much!

  16. #16
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Only Allow 1 Combo Box To Be Fill

    You're welcome...glad I could help. Thanks for the Rep.

+ 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. [SOLVED] Fill combo box list based on other combo box values
    By rain4uu in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-23-2013, 03:04 PM
  2. Fill Combo Box Dynamically
    By djblois1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-08-2013, 03:59 PM
  3. array to fill combo box
    By kieranbop in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-14-2011, 06:51 AM
  4. [SOLVED] Combo Box fill
    By Hal in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-20-2005, 02:50 PM
  5. Fill two column combo box
    By Steve in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-06-2005, 07:45 PM

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