Results 1 to 2 of 2
  1. #1
    Lounger
    Join Date
    Jan 2006
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Convert dates in Excel (2000)

    Hi,

    I needed to convert dates in Excel from this format yyyymmdd into thios format dd-mm-yyyy This little macro does that. Select the column with the dates and run the macro. Enjoy.

    Dim rCell As Range
    Sub geboortedatum()

    For Each rCell In Selection
    v$ = rCell
    If Len(v$) <> 8 Then Exit Sub

    v$ = Right(v$, 2) & "-" & Mid(v$, 5, 2) & "-" & Left(v$, 4)
    rCell = v$
    Next rCell

    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Convert dates in Excel (2000)

    Thanks.

    For Loungers who want to adapt this code to convert to US date format mm/dd/yyyy: change the line

    v$ = Right(v$, 2) & "-" & Mid(v$, 5, 2) & "-" & Left(v$, 4)

    to

    v$ = Mid(v$, 5, 2) & "/" & Right(v$, 2) & "/" & Left(v$, 4)

Posting Permissions

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