+ Reply to Thread
Results 1 to 11 of 11

Default Date in TextBox

  1. #1
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Washington DC
    MS-Off Ver
    Excel 2007
    Posts
    458

    Default Date in TextBox

    Hello everyone. How can I assign a default value to a textbox. In particular I have a textbox on a userform. When the userform is opened I want the textbox to show todays date. Currently I am using :

    Please Login or Register  to view this content.
    and this is written in the userfrom code. It's not working. Any suggestions?
    Last edited by AnthonyWB; 06-09-2011 at 03:27 PM.

  2. #2
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Default Date in TextBox

    hi,
    i use this method
    Please Login or Register  to view this content.
    Regards, John55
    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.

    ...enjoy -funny parrots-

  3. #3
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Washington DC
    MS-Off Ver
    Excel 2007
    Posts
    458

    Re: Default Date in TextBox

    John thanks !

    Please see my code below. I am not sure if it is good practice, or possible to use a private sub with an option explicit? Furthermore my code involves a command click.

    Now the userform shows at the instant the excel workbook open. I think the problem here is assigning the default date to the tetbox at the instant the excel book opens.

    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Default Date in TextBox

    HI,

    If you form shows in the workbook open then have the textbox load at the time the form shows.

    Please Login or Register  to view this content.
    Last edited by Charles; 06-09-2011 at 01:50 PM. Reason: had time to post before taking off
    Charles

    There are other ways to do this, this is but 1 !
    Be Sure you thank those who helped.
    IF YOU'RE SATISFIED BY ANY MEMBERS RESPONSE TO YOUR ISSUE PLEASE USE THE STAR ICON AT THE BOTTOM LEFT OF THE POST UNDER THEIR NAME.

  5. #5
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Washington DC
    MS-Off Ver
    Excel 2007
    Posts
    458

    Re: Default Date in TextBox

    Charles, thanks. it tried this (see below) and it did not work. Am I missing the point?

    Please Login or Register  to view this content.

  6. #6
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Default Date in TextBox

    Hi,


    The code for the text box should go in the code module for the Workbook" open.

  7. #7
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Washington DC
    MS-Off Ver
    Excel 2007
    Posts
    458

    Re: Default Date in TextBox

    Thank you. I can be dense at times. Out of curiousity. How would I add a day to the Now() date or subtract a day? Other than that it works.

  8. #8
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Default Date in TextBox

    try this
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Washington DC
    MS-Off Ver
    Excel 2007
    Posts
    458

    Re: Default Date in TextBox

    Hmmm,

    Please Login or Register  to view this content.
    .

    yeilds, 08/06/11.

  10. #10
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Default Date in TextBox

    sorry, maybe I did not understand...

  11. #11
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Washington DC
    MS-Off Ver
    Excel 2007
    Posts
    458

    Re: Default Date in TextBox

    Its all good. I can figure that part out. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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