Results 1 to 3 of 3
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    FORMAT date (2000)

    with the code here i want have 15/08/2008 but have 23/11/2312 !!!!!!!!

    Option Explicit
    Sub test()
    Dim strDate As String
    strDate = "150808"
    MsgBox Format(strDate, "dd/mm/yyyy")
    End Sub

  2. #2
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: FORMAT date (2000)

    Try:

    Sub test()
    Dim strDate As String
    strDate = "150808"
    strDate = Left(strDate, 2) & "/" & Mid(strDate, 3, 2) & "/" & Right(strDate, 2)
    MsgBox Format(strDate, "dd/mm/yyyy")
    End Sub
    Jerry

  3. #3
    2 Star Lounger
    Join Date
    Aug 2004
    Posts
    123
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: FORMAT date (2000)

    If you want to format date from 150808 -->to 15/08/2008

    An other way without VBA, by Text to Column built-in function :

    Select range of your data > Data > Text to Columns > Step 1. Next > Step 2 . Next > Step 3, Column Format choose : "Date" and "DMY", Finish

    Regards
    Bosco

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •