+ Reply to Thread
Results 1 to 4 of 4

Changing date format

  1. #1
    Registered User
    Join Date
    09-21-2011
    Location
    INDIA
    MS-Off Ver
    Excel 2007
    Posts
    17

    Changing date format

    I have prepared a small vba user form for entering the leave details. While entering the date in "From" and "To" fields (text boxes)in teh format dd/mm/yyyy, the data is written in the excel sheet as mm/dd/yyyy. Please help to rectify the error.
    I am appending the script...


    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by arlu1201; 11-04-2012 at 09:33 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: Changing date format

    Try this Anilswarrier.

    Please Login or Register  to view this content.
    Kind regards, Harry.

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Wrap the values with DateValue or CDate.
    Please Login or Register  to view this content.
    By the way, you don't need the loop at the end.

    Oh, and remember to format the date cells appropriately.
    Last edited by Norie; 11-04-2012 at 08:52 AM.
    If posting code please use code tags, see here.

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Changing date format

    Anil,

    Welcome to the forum.

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. If you need more information on how to use them, check my signature below this post.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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