Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
date query
I have dates in the format yyyy-mm-dd. How do I get VB to convert these into
date format? I want to use the dates in a calc to determine the number of months between 2 dates eg 2007-06-19 and 1995-09-01 |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
date query
Hi,
I'm not exactly sure whether you mean VB or a worksheet function so here's both. With the earlier date in A1 and the later date in A2 formatted as you dexcribe right click the sheet tab, view code and paste this in:- Sub sonic() MyDifference = DateDiff("M", Range("A1").Value, Range("A2").Value) End Sub Or as a workshet function =DATEDIF(A1,A2,"m") Mike "Hilton" wrote: I have dates in the format yyyy-mm-dd. How do I get VB to convert these into date format? I want to use the dates in a calc to determine the number of months between 2 dates eg 2007-06-19 and 1995-09-01 |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
date query
Hi,
The dates are in a text file. There are no dates in the worksheet. The VBA code can read the date strings but how do I convert them to an acceptable date format? "Mike H" wrote in message ... Hi, I'm not exactly sure whether you mean VB or a worksheet function so here's both. With the earlier date in A1 and the later date in A2 formatted as you dexcribe right click the sheet tab, view code and paste this in:- Sub sonic() MyDifference = DateDiff("M", Range("A1").Value, Range("A2").Value) End Sub Or as a workshet function =DATEDIF(A1,A2,"m") Mike "Hilton" wrote: I have dates in the format yyyy-mm-dd. How do I get VB to convert these into date format? I want to use the dates in a calc to determine the number of months between 2 dates eg 2007-06-19 and 1995-09-01 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Date query | Excel Worksheet Functions | |||
Date Query | Excel Discussion (Misc queries) | |||
Query Latest Date | Excel Discussion (Misc queries) | |||
Date query? | Excel Discussion (Misc queries) | |||
How do I enter a date range ie -7 from current date in MS QUERY | Excel Discussion (Misc queries) |