+ Reply to Thread
Results 1 to 10 of 10

VBA Help Needed to Format a Textbox for today Date

  1. #1
    Registered User
    Join Date
    04-07-2016
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    35

    VBA Help Needed to Format a Textbox for today Date

    Hi,

    I need some help here, I made an excel form that will generate a final quotation that cannot be modified by the user. I have inserted a text box (activeXcontrol) from Developer, and I want it to display today's date. I first tried to make it display the value of a cell, but it converts the date into a number. Since this text box is part of an object, I cannot just use a cell to do this job.

    Any suggestion will be much appreciated

    Thanks and have a great day

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,705

    Re: VBA Help Needed to Format a Textbox for today Date

    Try this:
    Please Login or Register  to view this content.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: VBA Help Needed to Format a Textbox for today Date

    Assuming your linked cell is A1 and you textbox is named TextBox1

    Please Login or Register  to view this content.
    If you are happy with my response please click the * in the lower left of my post.

  4. #4
    Registered User
    Join Date
    04-07-2016
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    35

    Re: VBA Help Needed to Format a Textbox for today Date

    Thanks for the help on this one,

    I tried but this doesn't work, I still end up with a number instead of an actual date format

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,705

    Re: VBA Help Needed to Format a Textbox for today Date

    I suspect it is a formatting issue. Look at this Link to understand dates and times in Excel

    http://www.exceltactics.com/definiti...s-times-excel/

  6. #6
    Registered User
    Join Date
    04-07-2016
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    35

    Re: VBA Help Needed to Format a Textbox for today Date

    Thanks

    I will check this one

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: VBA Help Needed to Format a Textbox for today Date

    Where exactly is the textbox located?

    Is it on a sheet or a userform?
    If posting code please use code tags, see here.

  8. #8
    Registered User
    Join Date
    04-07-2016
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    35

    Re: VBA Help Needed to Format a Textbox for today Date

    It's on a user form,

    I found a way around it, I linked the textbox to a cell, and I placed a formula in the cell to convert today's date into text

    Something like
    Please Login or Register  to view this content.

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: VBA Help Needed to Format a Textbox for today Date

    All you should need is something like this which would go in the userform's Initialize event.
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    04-07-2016
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    35

    Re: VBA Help Needed to Format a Textbox for today Date

    Thanks Norie,

    I will try this one also

+ 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. Using TODAY Date Function in formula and leaving cell blank until needed.
    By slugger23 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-14-2016, 05:04 PM
  2. [SOLVED] Excel 2010 - Userform - display date from textbox in a label or textbox in 'ddd' format
    By theshybutterfly in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2015, 10:54 PM
  3. Replies: 4
    Last Post: 05-08-2014, 10:13 AM
  4. condit. format: If date in cell = today, display "Today"
    By ratkins in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-14-2013, 01:33 PM
  5. Replies: 1
    Last Post: 09-30-2012, 03:01 PM
  6. Replies: 1
    Last Post: 05-03-2011, 01:50 AM
  7. Replies: 1
    Last Post: 08-24-2009, 09:46 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