+ Reply to Thread
Results 1 to 3 of 3

[Userform] Inserted details disappear after msg box pop up

  1. #1
    Registered User
    Join Date
    02-28-2020
    Location
    Hong Kong
    MS-Off Ver
    2013
    Posts
    22

    [Userform] Inserted details disappear after msg box pop up

    I created a userform which users need to enter some text boxes and choose from combo boxes.
    Some are mandatory, so I decided to use message boxes as reminders when click the "Create Record" Button.
    As there are so many fields, I want to put them all in a sub then can simply call in other private sub as well.

    But there is a problem that all the inserted data will be gone after any one of the msgboxes.

    e.g. I have 10 text boxes and 3 combo boxes are mandatory, I forget to fill in one, and msg box pop up, after closed the msg box, all the other 12 fields have been cleared. It is not user-friendly, so I want to remain all the filled text or the chose option in the combo box

    My questions:
    1. how can I write to solve this situation?
    2. is it possible to write all in one sub?

    Thank you

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: [Userform] Inserted details disappear after msg box pop up

    see big yellow banner at head of page - how to upload your workbook.
    help us to help you with an appropriate answer.

  3. #3
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: [Userform] Inserted details disappear after msg box pop up

    There are many ways to do what you want, taking advantage of the power of the UserForm including:
    a. Use a Status Label in the UserForm, instead of a MsgBox - use Red Font (ForeColor) when there is an error.
    b. Hide the "Create Record" CommandButton until all prerequisites are met.
    c. Color the Controls (TextBoxes, ComboBoxes) in red, when the prerequisite is not met.

    Like torachan said, if you upload a small sample file, with your existing code, we can do a better job of helping you.

    Lewis

+ 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. Long Press 'Alt' causes my userform to disappear and the Ribbon to appear
    By superlative in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-04-2019, 01:12 PM
  2. Replies: 1
    Last Post: 01-03-2018, 01:40 PM
  3. Userform All Textbox and Combobox Disappear
    By DKTRL in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-01-2016, 03:44 PM
  4. Workbook.Save makes Userform Disappear
    By Antenne88 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-26-2015, 06:30 PM
  5. userform and formula wich disappear
    By coucou1105 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-05-2013, 12:27 PM
  6. [SOLVED] How to make userform disappear while called subroutine is running
    By Cornelia in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-16-2006, 05:50 PM
  7. [SOLVED] Pictures inserted into a message disappear
    By Anomalia in forum Excel General
    Replies: 1
    Last Post: 12-24-2005, 10:55 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