![]() |
Vba excel - converting Number to Date
Hi all, I have a list of numbers, and I need to sort them as date. fo example: 281100 == must be 28/november/2000 110303 == must be 11/march/2003 271004 == must be 27/october/2004 I am trying to convert these numbers into dates, and sorting them, bu getting errors in the translation, for example, if I try NewDate=CDate(110303), I get 30/December/2201 instead o 11/November/2003 Could anybody help, please? Thanks in advance, Aldo -- ajliak ----------------------------------------------------------------------- ajliaks's Profile: http://www.excelforum.com/member.php...nfo&userid=819 View this thread: http://www.excelforum.com/showthread.php?threadid=27278 |
Vba excel - converting Number to Date
Dim NewDate as Date
Dim cell as Range, sStr as String set cell = ActiveCell NewDate = cDate(Mid(cell,3,2) & "\" & Left(cell,2) & "\" & Right(cell,2)) sStr = format(NewDate,"dd/mmmm/yyyy") -- Regards, Tom Ogilvy "ajliaks" wrote in message ... Hi all, I have a list of numbers, and I need to sort them as date. for example: 281100 == must be 28/november/2000 110303 == must be 11/march/2003 271004 == must be 27/october/2004 I am trying to convert these numbers into dates, and sorting them, but getting errors in the translation, for example, if I try NewDate=CDate(110303), I get 30/December/2201 instead of 11/November/2003 Could anybody help, please? Thanks in advance, Aldo. -- ajliaks ------------------------------------------------------------------------ ajliaks's Profile: http://www.excelforum.com/member.php...fo&userid=8196 View this thread: http://www.excelforum.com/showthread...hreadid=272786 |
All times are GMT +1. The time now is 05:09 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com