+ Reply to Thread
Results 1 to 6 of 6

Use a second userform in place of an input box help

  1. #1
    Registered User
    Join Date
    03-23-2015
    Location
    Austin, Texas
    MS-Off Ver
    2016
    Posts
    11

    Use a second userform in place of an input box help

    I want to use a userform in place of an input box. Basically, you have the first userform which opens when Excel opens and looks something like this
    1.0.jpg which asks to enter the date correctly in the format stated and assigns it to variable1 - the command button also starts the rest of the code. Assume the user input was mmddyyyy, I would then like the following second userform2.0.jpg to pop up as follows which checks the format of the date, loops if incorrect, and then uses a correctly formatted date to assign to the variable1 and contiunes on with the original code upon clicking on commandbutton 2. Any idea how this can be done?

  2. #2
    Forum Contributor
    Join Date
    09-28-2014
    Location
    harbin,china
    MS-Off Ver
    2007
    Posts
    162

    Re: Use a second userform in place of an input box help

    Hi, MontgomeryBrea,
    I think you needn't the second userform, mending label's caption can do work.

  3. #3
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Use a second userform in place of an input box help

    Assume the user input was mmddyyyy,
    Did you mean to say "was not" mmddyyyy?
    If you are looking to validate the date the user entered, usually that is done after they input the date via the code. If it's not valid you can display a message box where they can click ok which can put them back into the same form to try again or they can click cancel to go on to something else.
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  4. #4
    Forum Contributor
    Join Date
    09-28-2014
    Location
    harbin,china
    MS-Off Ver
    2007
    Posts
    162

    Re: Use a second userform in place of an input box help

    Hi
    Is it like this?
    Attached Files Attached Files
    Last edited by simcode; 03-24-2015 at 12:12 PM.

  5. #5
    Registered User
    Join Date
    03-23-2015
    Location
    Austin, Texas
    MS-Off Ver
    2016
    Posts
    11

    Re: Use a second userform in place of an input box help

    I think that's very close but just to be sure I've just decided to post the actual screenshots as opposed to simplified examples of my user forms with more detail so that I can actually let you all help me. The first userform is as follows.

    FirstUserForm1.jpg

    and then the second is,

    SecondUserForm2.jpg

  6. #6
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Use a second userform in place of an input box help

    Just so you know IsNumeric doesn't just accept numbers like 123. It will happily accept numbers such as 123.45 and $4.00 so if you want to restrict to 6 integers with no dollar signs or decimals this is not a good choice.

    I've attached a small example of how to validate the user input.
    There are several things you can do.
    1) You can make sure the user entered 6 digits only, not less than 6 and not more than 6. No spaces or non numbers.

    2) You can also restrict which numbers are used in each position. In the example I gave you two boxes. One allows 0-9 in each of the 6 positions. The second box does not allow leading zeros. For example 012345 would be invalid. You can restrict all 6 positions if you like, in other words no zeros in the first position, 0-4, in the second 1-5, in the third etc.

    Good Luck!!!
    Attached Files Attached Files
    Last edited by skywriter; 03-24-2015 at 03:15 PM.

+ 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] Input Box Find Value Offset and place value
    By tjw06d in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-27-2014, 02:02 PM
  2. [SOLVED] Excel vba userform - lock userform in place
    By PANTECH in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-30-2013, 10:30 AM
  3. Excel form to place input into different worksheets
    By chijeff in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-24-2012, 03:35 PM
  4. Using the input box to place number into a macro formula
    By davidcailler in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-15-2012, 05:19 PM
  5. [SOLVED] Can validation input messages be locked in place?
    By Chris in forum Excel General
    Replies: 1
    Last Post: 03-22-2006, 04:00 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