Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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" wrote in message
oups.com...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
change year date kevin New Users to Excel 1 February 15th 06 07:07 AM
change year date kevin Excel Discussion (Misc queries) 4 January 20th 06 05:11 PM
change year date kevin Excel Worksheet Functions 1 January 20th 06 04:34 PM
change year date kevin New Users to Excel 1 January 20th 06 04:34 PM
Change date by one year Oldjay New Users to Excel 2 December 14th 05 10:28 PM


All times are GMT +1. The time now is 02:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"