+ Reply to Thread
Results 1 to 4 of 4

Excel 2007, Userform Textbox Date Format and Calendar Control Userform

  1. #1
    Registered User
    Join Date
    07-29-2013
    Location
    Colorado
    MS-Off Ver
    Excel 2007
    Posts
    19

    Excel 2007, Userform Textbox Date Format and Calendar Control Userform

    Hi All,

    I've created the following Userform:

    Userform.jpg

    There are two things I am trying to accomplish. The first thing is to make the two textboxes force the user to enter the MM/DD/YYYY format. Alternatively, I'm also trying to give the user the option to click "Add Date" which will bring up the Calendar Control userform and then pick a date which will then be entered into the textbox in the MM/DD/YYYY format. Can anyone help me with the VBA coding for this?

    Jeff

  2. #2
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Excel 2007, Userform Textbox Date Format and Calendar Control Userform

    instead of using a text box, why dont you use a lable control, and then only allow the user to change the date using the calendar control. That way the format will always be correct.you can always use the intialize event to add todays date when the form is opened.
    i dont have the infor on this pc, but might be able to provide some info later when i get home.
    Regards
    Sean

    Please add to my reputation if you think i helped
    (click on the star below the post)
    Mark threads as "Solved" if you have your answer
    (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code:
    [code] Your code here [code]
    Please supply a workbook containing example Data:
    It makes its easier to answer your problem & saves time!

  3. #3
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Excel 2007, Userform Textbox Date Format and Calendar Control Userform

    Here, i found one on a workbook which i have altered for this example
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    07-29-2013
    Location
    Colorado
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Excel 2007, Userform Textbox Date Format and Calendar Control Userform

    Works great. Thanks Sean!

+ 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. Date Format in userform textbox is different from excel worksheet?
    By z-eighty2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-30-2013, 06:46 AM
  2. Pass Date value from custom calendar control to Userform Combo Box:
    By rvc81 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-23-2013, 12:59 AM
  3. [SOLVED] vba userform calendar to populate textbox in another userform
    By kaurka in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-29-2012, 01:43 PM
  4. [SOLVED] Using a Calendar Control within a Userform with an invisible textbox to hold value select
    By Orestees in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-11-2012, 03:40 PM
  5. Date Format for textbox in userform
    By processchip in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-08-2011, 06:42 AM

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