Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / General Excel Questions / November 2007

Tip: Looking for answers? Try searching our database.

date query

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Hilton - 20 Nov 2007 09:49 GMT
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
Mike H - 20 Nov 2007 10:02 GMT
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

> 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
Hilton - 20 Nov 2007 10:42 GMT
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?

> Hi,
>
[quoted text clipped - 17 lines]
> >
> > eg 2007-06-19  and 1995-09-01
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.