+ Reply to Thread
Results 1 to 5 of 5

How can I check all comboboxes for blanks within a userfor?

  1. #1
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Question How can I check all comboboxes for blanks within a userfor?

    Hello all,
    This is question 1 of 3. I will post the other 2 in their own threads.
    In the attached I have a simple userform with 3 comboboxes and 1 textbox. What I would like to do is, when the Submit button is clicked, check 3 comboboxes and 1 textbox for blanks. If ANY number of them are blank, I want to set focus to the 1st blank box, have the border of that box to turn red then exit sub. If none of them are blank, then run other code. I used to have code that would "loop" through all the controls in a form and look for blanks but I have no idea where I saved it.

    BTV Excel Forum Sample.xlsm
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

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

    Re: How can I check all comboboxes for blanks within a userfor?

    This one should do it.
    Although you would have to change BorderStyle to BorderStyleSingle for all controls first to see result.

    Please Login or Register  to view this content.
    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.

  3. #3
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: How can I check all comboboxes for blanks within a userfor?

    Perfect as usual bakerman!! I didn't like the way the combobox looked when I changed it to Single, so I changed it back and used BackColor instead of BorderColor.

    Thanks once again bakerman!!!

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

    Re: How can I check all comboboxes for blanks within a userfor?

    You're welcome and thanks for rep+.

  5. #5
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: How can I check all comboboxes for blanks within a userfor?

    No problem.

+ 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. EXACT check ignore blanks
    By shdwfx in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 10-08-2019, 10:29 AM
  2. Replies: 3
    Last Post: 02-18-2015, 02:02 PM
  3. Help! Entire Row Hidden - w/Two ComboBoxes - Doesn't Hide the ComboBoxes
    By ocnmel in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-06-2015, 09:27 AM
  4. [SOLVED] IF Statement to check for blanks first
    By drewberts in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-30-2014, 05:06 PM
  5. Userfor VBA code update
    By Damian37 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-03-2014, 09:30 AM
  6. Check for Blanks within a selection range
    By Eamonn in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-27-2011, 02:29 PM
  7. Check for blanks within Pivot with VBA
    By tmck in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-12-2010, 02:39 PM

Tags for this Thread

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