Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How does one in VBA code convert a date with format yyyymmdd (eg today's
date = 20110505) to a date recognized by Excel. I tried ConvertedDate = Application.Worksheetfunction.Date(Left(InputDate, 4),Mid(Inputdate,5,2),Right(InputDate,2)) but that does not work. It would be easy enough in the spreadsheet, but in VBA? Thanks Laurence |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Am Fri, 6 May 2011 08:50:33 +0200 schrieb Laurence Lombard:
How does one in VBA code convert a date with format yyyymmdd (eg today's date = 20110505) to a date recognized by Excel. I tried ConvertedDate = Application.Worksheetfunction.Date(Left(InputDate, 4),Mid(Inputdate,5,2),Right(InputDate,2)) but that does not work. It would be easy enough in the spreadsheet, but in ConvertedDate =DateSerial(Left(Inputdate, 4), Mid(Inputdate, 5, 2), Right(Inputdate, 2)) Regards Claus Busch -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Fri, 6 May 2011 08:50:33 +0200, "Laurence Lombard" wrote:
How does one in VBA code convert a date with format yyyymmdd (eg today's date = 20110505) to a date recognized by Excel. I tried ConvertedDate = Application.Worksheetfunction.Date(Left(InputDate ,4),Mid(Inputdate,5,2),Right(InputDate,2)) but that does not work. It would be easy enough in the spreadsheet, but in VBA? Thanks Laurence Where "d" is a date in the format of yyyymmdd: ConvertDate = CDate(Format(d, "0000-00-00")) |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Claus and Ron - both very useful replies. I knew there would be ways,
just did not know how to find them. Laurence "Ron Rosenfeld" wrote in message ... On Fri, 6 May 2011 08:50:33 +0200, "Laurence Lombard" wrote: How does one in VBA code convert a date with format yyyymmdd (eg today's date = 20110505) to a date recognized by Excel. I tried ConvertedDate = Application.Worksheetfunction.Date(Left(InputDat e,4),Mid(Inputdate,5,2),Right(InputDate,2)) but that does not work. It would be easy enough in the spreadsheet, but in VBA? Thanks Laurence Where "d" is a date in the format of yyyymmdd: ConvertDate = CDate(Format(d, "0000-00-00")) |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Sat, 7 May 2011 12:27:07 +0200, "Laurence Lombard" wrote:
Thanks Claus and Ron - both very useful replies. I knew there would be ways, just did not know how to find them. Laurence Glad to help. Thanks for the feedback. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
need to convert microsoft date to yyyymmdd | Excel Discussion (Misc queries) | |||
how do I convert date format yyyymmdd to mm/dd/yyyy | Excel Worksheet Functions | |||
How do I change date yyyymmdd to a Excel-supported date format? | Excel Worksheet Functions | |||
convert date (YYYYMMDD) to weeknumber | Excel Worksheet Functions | |||
yyyymmdd date format | Excel Programming |