+ 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
    Excel 2007
    Posts
    6,464

    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
    Excel 2007
    Posts
    6,464

    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)

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