+ Reply to Thread
Results 1 to 13 of 13

ComboBox will add value if its not empty

  1. #1
    Forum Contributor 323100N's Avatar
    Join Date
    08-11-2017
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    272

    ComboBox will add value if its not empty

    Hi,

    I have this userform with 6 ComboBoxes, if combobox has a value it will show "5" on cell H4 and it will add another 5 depending on the combobox that has a value or not empty. If the Combobox is empty it will subtract 5 to cell H4.

    Thank you!
    Last edited by 323100N; 05-25-2018 at 05:21 AM.

  2. #2
    Forum Contributor 323100N's Avatar
    Join Date
    08-11-2017
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    272

    Re: ComboBox will add value if's not empty

    Please see attached file
    Attached Files Attached Files

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: ComboBox will add value if's not empty

    You need to elaborate more because this isn't clear at all.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  4. #4
    Forum Contributor 323100N's Avatar
    Join Date
    08-11-2017
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    272

    Re: ComboBox will add value if's not empty

    Sorry for the confusion. If the value of 1 Combobox is not empty cell H4 will add value of 5 and if combobox is empty it will minus or deduct 5 to cell H4. So for every combobox it has a value or amount of 5.

    thank you!

  5. #5
    Forum Contributor 323100N's Avatar
    Join Date
    08-11-2017
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    272

    Re: ComboBox will add value if its not empty

    Here is the screenshot that i want to achieved. In this screenshot it will shot the total of 25 because all of the combobox has a value, then for instances that 1 combobox has no value it will minus 5 so the total price will be 20. Thank you!
    Attached Images Attached Images

  6. #6
    Forum Contributor 323100N's Avatar
    Join Date
    08-11-2017
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    272

    Re: ComboBox will add value if its not empty

    re-upload the screenshot
    Attached Images Attached Images

  7. #7
    Forum Contributor 323100N's Avatar
    Join Date
    08-11-2017
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    272

    Re: ComboBox will add value if its not empty

    any help please?

  8. #8
    Forum Contributor
    Join Date
    09-21-2009
    Location
    Belgium - Mechelen
    MS-Off Ver
    Office 365 - version 2310
    Posts
    278

    Re: ComboBox will add value if its not empty

    323100N,

    Maybe the attached file could help you on the right track.
    Check the userform1 and code added to the comboboxes.

    krgds,
    Mario
    Attached Files Attached Files

  9. #9
    Forum Contributor 323100N's Avatar
    Join Date
    08-11-2017
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    272

    Re: ComboBox will add value if its not empty

    Hi MarMo this is perfect. Thank you for your help!

  10. #10
    Forum Contributor
    Join Date
    09-21-2009
    Location
    Belgium - Mechelen
    MS-Off Ver
    Office 365 - version 2310
    Posts
    278

    Re: ComboBox will add value if its not empty

    Hi 323100N,

    Glad to hear.

    If this solved your problem, please change your thread to [SOLVED].
    Even a little help can be a big help !!
    1. A sample workbook says more then words. Add problem description and solution so we can understand the problem.
    2. Your appreciation is accepted by clicking the star "Add Reputation" at the lower left of the post.
    3. If your problem is solved, mark it as [SOLVED]: See "FAQ : " https://www.excelforum.com/faq.php
    4. Use [CODE] [/CODE] tags to illustrate your code: see here

  11. #11
    Forum Contributor 323100N's Avatar
    Join Date
    08-11-2017
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    272

    Re: ComboBox will add value if its not empty

    Sorry one more thing, how to prevent by selecting again the same value of combobox? for example the "fries" was already used it will removed on the selection? thank you

  12. #12
    Forum Contributor
    Join Date
    09-21-2009
    Location
    Belgium - Mechelen
    MS-Off Ver
    Office 365 - version 2310
    Posts
    278

    Re: ComboBox will add value if its not empty

    You should then consider checkboxes instead of comboboxes on your userform.
    You can only choose the "fries" once, as all of the other ingredients.

    It's not impossible to do the comboboxes, but it's more complicated.
    Try the checkboxes instead.
    See attached file with modified code on the userform.

    Krgds
    Mario
    Attached Files Attached Files

  13. #13
    Forum Contributor 323100N's Avatar
    Join Date
    08-11-2017
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    272

    Re: ComboBox will add value if its not empty

    You have a point with regards on using checkbox. Ill check on this. Thank you!

+ 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. Replies: 3
    Last Post: 03-22-2018, 11:25 AM
  2. [SOLVED] ComboBox to populate Listbox and 2nd Combobox based on 1st combobox dropdown choice
    By bbqqsmokeman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-15-2017, 08:21 PM
  3. ComboBox values source being changed based on another combobox selection in a UserForm
    By stephenanderson in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-08-2016, 11:12 PM
  4. [SOLVED] Code required to Auto Populate 3rd Combobox based on 02nd Combobox Selection
    By bimmy80 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-14-2015, 03:56 AM
  5. Replies: 1
    Last Post: 11-07-2014, 01:21 PM
  6. [SOLVED] Make combobox list options dependant on selection in another combobox within a userform
    By Vladimir_Dobvchenko in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-23-2013, 05:30 AM
  7. [SOLVED] Excel Userform: Populate other controls (i.e. textbox & combobox) based on combobox select
    By MileHigh_PhD in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-22-2013, 04:50 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