+ Reply to Thread
Results 1 to 2 of 2

Change year value in a date column...

  1. #1
    bushtor
    Guest

    Change year value in a date column...

    Hi,

    I have two adjacent columns, one with date values displayed like
    DD.MM.YYYY and another with only the two last digits in a year value.
    Example:

    03.12.2005 89
    11.05.2005 67
    31.01.2005 93

    I need to replace the first column's year value with the second
    column's value + 1900. Result wanted:

    03.12.1989
    11.05.1967
    31.01.1993

    many years ago I did some excel scripting but I'm definately not
    capable of solving this now. Thanks a lot if anyone have a minute to
    show me a macro which solves this issue

    best regards

    tor


  2. #2
    Norman Jones
    Guest

    Re: Change year value in a date column...

    Hi Bushtor,

    Try:
    '=====================>.
    Sub Tester()
    Dim rng As Range
    Dim rCell As Range

    Set rng = Range("A1:A10") '<<========= CHANGE

    For Each rCell In rng.Cells
    If IsDate(rCell) Then
    With rCell
    .Value = DateSerial(rCell(1, 2).Value, _
    Month(.Value), Day(.Value))
    End With
    End If

    Next

    End Sub
    '=====================>.

    ---
    Regards,
    Norman



    "bushtor" <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    >
    > I have two adjacent columns, one with date values displayed like
    > DD.MM.YYYY and another with only the two last digits in a year value.
    > Example:
    >
    > 03.12.2005 89
    > 11.05.2005 67
    > 31.01.2005 93
    >
    > I need to replace the first column's year value with the second
    > column's value + 1900. Result wanted:
    >
    > 03.12.1989
    > 11.05.1967
    > 31.01.1993
    >
    > many years ago I did some excel scripting but I'm definately not
    > capable of solving this now. Thanks a lot if anyone have a minute to
    > show me a macro which solves this issue
    >
    > best regards
    >
    > tor
    >




+ 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