+ Reply to Thread
Results 1 to 13 of 13

Help with userform.

  1. #1
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Help with userform.

    Hi,

    I have a userform (see attached file). This file is just a subset of my original program.

    Background: Userform shows fine and provided the user selects all the appropriate inputs i can extract the data from the userform.

    Problem: However, what my code lacks is the proper checks to make sure all the inputs have been selected properly. Can someone help me.
    For example: If user selects the option to begin updating the rates from a given date.......but does not select an appropriate date from the list box well my code does not really handle this well.

    can someone help me?
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Help with userform.

    I've not looked at your actual file but you can add an IF statement to check if all 'mandatory' fields are used before it runs any code.


    For example:
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: Help with userform.

    how to get userform to continue to show until all the inputs have been input correctly. i guess this is what i am looking for. i am close but not quite there.

  4. #4
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Help with userform.

    Change/add the Textbox names to check the required fields.

    If the statement is false the routine will continue your code.

    Just needs to be applied to the Commandbutton_click event

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Help with userform.

    what if your current code for CommandButton_click? This must have Unload in it before you apply the statement

  6. #6
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Help with userform.

    Got your file open

    use this

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: Help with userform.

    hi not sure exactly what you want me to do..........can u update the code and send back? sorry its just i dont quite understand what you mean.

  8. #8
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Help with userform.

    ALT+F11 to open VBA

    Right click on Userform4 and view code

    Paste the above code over your current CommanButton1_Click code

  9. #9
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: Help with userform.

    do i have the code
    Please Login or Register  to view this content.
    in the right place?

  10. #10
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: Help with userform.

    ok, i understand. i tried what you said but it does not seem to work in all cases. for example........if i select everything "except" the date it does not work.

    What i mean is lets say i select name, select salary, select new rate, but now i select option button 2 which means i want to select a start date.....
    ...if i input all the right stuff except the "start date" program does not catch this.

  11. #11
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Help with userform.

    should be set to -1 sorry, I've changed the code, does this work?

  12. #12
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Help with userform.

    Slowly getting there:

  13. #13
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: Help with userform.

    ok, based on your suggestion i added the following the commandobject1 code

    Please Login or Register  to view this content.
    and this seemed to take care of my issue.

    One more question:
    Is the "Exit Do" in the right place........how does this work.......seems to me that it should always exit the loop

+ 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] Save data from UserForm into Sheet (how to resolve runtime errors in UserForm tutorial)
    By eighty6 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-14-2015, 07:41 PM
  2. Userform Combobox - select from list, store this as default each time userform loads
    By thecdnmole in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-19-2014, 07:48 AM
  3. combining chart userform and data transfer userform into 1 userform
    By H_Kennedy in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 01-04-2014, 07:11 AM
  4. combining chart userform and data transfer userform into 1 userform
    By H_Kennedy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-03-2014, 12:28 PM
  5. [SOLVED] Changed userform combobox to listbox, unable to get userform to retrieve datasheet values
    By dragonabsurdum in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-29-2013, 01:38 PM
  6. [SOLVED] Open a userform from a userform, but preserve the info in the original userform
    By jfoerch in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-25-2013, 02:38 PM
  7. userform is large.....how to use scrollbar of userform to show all of the userform
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-05-2010, 04:11 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