+ Reply to Thread
Results 1 to 8 of 8

Excel User Form - Date format problem

  1. #1
    Registered User
    Join Date
    06-12-2022
    Location
    cairo
    MS-Off Ver
    2013
    Posts
    4

    Excel User Form - Date format problem

    Cross-posted at https://www.mrexcel.com/board/thread...-form.1207643/

    Hello

    I've created an Excel User Form which requires a date to be entered (dd/mm/yy). On entering the date in to the form it show correctlys when the data is added to the Excel worksheet .

    But When the textbox calls the information from the spreadsheet it converts to number not date format
    Many Thanks
    Attached Images Attached Images
    Last edited by 6StringJazzer; 06-13-2022 at 10:22 AM. Reason: Moderator added cross-post link

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: Excel User Form - Date format problem

    Probably you use textboxes to display the data on the userform. The numkber visible is 7th Feb 2022. Writing date value to textbox convert it to text like:
    Please Login or Register  to view this content.
    Best Regards,

    Kaper

  3. #3
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: Excel User Form - Date format problem

    see big yellow banner - upload your workbook with 10 or 12 rows of typical data.
    far easier then to give you a formatting answer in context to your application.
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

  4. #4
    Registered User
    Join Date
    06-12-2022
    Location
    cairo
    MS-Off Ver
    2013
    Posts
    4

    Re: Excel User Form - Date format problem

    excel attached
    Last edited by amadoo0; 06-13-2022 at 10:26 AM.

  5. #5
    Registered User
    Join Date
    06-12-2022
    Location
    cairo
    MS-Off Ver
    2013
    Posts
    4

    Re: Excel User Form - Date format problem

    attached file please check it

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,705

    Re: Excel User Form - Date format problem

    Note that there are extensive responses in the cross-post

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not told us about this. You are required to do so.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important.

    I have added it since it's your first post.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  7. #7
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: Excel User Form - Date format problem

    rather than just answer your immediate question I have uploaded a UserForm and its related code which you may find helpful.
    it addresses many issues - do not use 'rowsource' it can be unstable especially in larger apps as it is constantly reading the sheet which slows processes.
    try using a 'structured table' for your database - leave UserForm controls with their default name (i.e. TextBox1 etc.,) you can then loop through them - this saves countless rows of code naming each individual when reading/writing data to the sheet.
    If you put the 'structured table' into an array it is then stored in memory making access far quicker than reading the sheet every time.
    With my calender you will see the buttons are dealt with by a very small module as a button class - this saves the need for individual code on 42 buttons.
    To input a new item first press 'NEW' this clears the form and activates the 'ADD' button - enter your data and press 'ADD' to save to the sheet - the rest should be intuitive.
    Hope some of this proves useful.
    Also do not hard code combobox selections - use individual tables to populate them - you will find this useful when making future additions - (i.e. no need to constantly update code.)
    Attached Files Attached Files
    Last edited by torachan; 06-13-2022 at 10:41 AM.

  8. #8
    Registered User
    Join Date
    06-12-2022
    Location
    cairo
    MS-Off Ver
    2013
    Posts
    4

    Re: Excel User Form - Date format problem

    thanks dear

+ 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. VBA User form - date fields convert to US format instead of UK format
    By motokaxperts in forum Excel Programming / VBA / Macros
    Replies: 120
    Last Post: 10-23-2019, 11:52 AM
  2. [SOLVED] UK vs US Date Format in User Form
    By annieb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-05-2013, 07:54 PM
  3. Excel User Form - Date format
    By Alice21 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-25-2012, 09:10 AM
  4. Date Format in User Form
    By Shazz in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-06-2012, 08:40 AM
  5. date format in VBA user form
    By TerryWingfield in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-15-2008, 08:31 AM
  6. Date Format problem in User Form
    By vandanavai in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-27-2006, 11:07 PM
  7. [SOLVED] date format in user form
    By TUNGANA KURMA RAJU in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-07-2006, 01:20 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