+ Reply to Thread
Results 1 to 7 of 7

SetFocus back to ComboBox on exit event doesn't seem to work (Excel 2010)

  1. #1
    Registered User
    Join Date
    03-21-2015
    Location
    East Coast
    MS-Off Ver
    2010, 2013
    Posts
    4

    SetFocus back to ComboBox on exit event doesn't seem to work (Excel 2010)

    I have a custom form with a combo box followed by a button. Here is process and error:
    1. User enters a value in combo box and hits tab
    2. This fires the combo box Exit event, the code wherein verifies if the value entered by user in (1) is valid or not
    3. If the value is not valid, a msg box shows a message for the user to enter correct value
    4. This is followed by an setfocus expression to move the focus back to combo box.
    5. However, the focus does move to the custom button instead of moving back to the combo box. Where am I going wrong?

    Here is the code:
    Please Login or Register  to view this content.
    Last edited by sx4vba; 03-21-2015 at 11:18 AM.

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

    Re: SetFocus back to ComboBox on exit event doesn't seem to work (Excel 2010)

    Wrong answer private
    Last edited by gmr4evr1; 03-21-2015 at 11:30 AM.
    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

  3. #3
    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: SetFocus back to ComboBox on exit event doesn't seem to work (Excel 2010)

    Hi sx4vba

    Welcome to the Forum!!!

    Try this...
    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.

  4. #4
    Registered User
    Join Date
    03-21-2015
    Location
    East Coast
    MS-Off Ver
    2010, 2013
    Posts
    4

    Re: SetFocus back to ComboBox on exit event doesn't seem to work (Excel 2010)

    Quote Originally Posted by jaslake View Post
    Hi sx4vba

    Welcome to the Forum!!!

    Try this...
    Please Login or Register  to view this content.
    Thanks a lot. It works, but don't know why- sorry I have picked up programming after 15 years and trying to read through VBA as fast as possible, but still lot to learn!

    Here is the secondary problem though - now the focus stays in the combo box; however, the Cancel button that I have provided in the form for the user to unload the form and get out doesn't seem to work as MsgBox ("Please enter valid creator name") keeps firing from preventing the unload.

  5. #5
    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: SetFocus back to ComboBox on exit event doesn't seem to work (Excel 2010)

    Hi sx4vba

    If you'd like us to troubleshoot the issue please attach a copy of your workbook.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    INCLUDE ANY CODE YOU'RE USING OR HAVE TRIED.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

  6. #6
    Registered User
    Join Date
    03-21-2015
    Location
    East Coast
    MS-Off Ver
    2010, 2013
    Posts
    4

    Re: SetFocus back to ComboBox on exit event doesn't seem to work (Excel 2010)

    Thanks for the offer. Let me working my problem bit more; otherwise, will send you the workbook. I have anyway marked this thread as solved, as your reply did solve the issue; and after googling a bit I know why? Thanks anyway for quick reply.

  7. #7
    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: SetFocus back to ComboBox on exit event doesn't seem to work (Excel 2010)

    You're welcome...glad I could help.

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

    If you need additional help let me know.

+ 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] Copying filtered table doesn't work as it is expected in Excel 2010
    By abbassi in forum Excel General
    Replies: 2
    Last Post: 06-29-2014, 01:57 AM
  2. Print preview doesn't work properly in Excel 2010
    By abbassi in forum Excel General
    Replies: 7
    Last Post: 05-25-2014, 12:46 AM
  3. =SUM(C:C) doesn't work using Excel 2010.
    By joaquinwalking in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 05-22-2014, 04:02 PM
  4. SetFocus doesn't work properly on a Userform on ComboBoxes and TextBoxes
    By pimre in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-15-2013, 03:15 PM
  5. Excel 2010 Paste Doesn't work twice
    By MrsRobinson in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-13-2013, 11:06 AM

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