PC Review


Reply
Thread Tools Rate Thread

Converting Dates

 
 
wutzke
Guest
Posts: n/a
 
      16th Mar 2008
Given a cell value of "Feb '08 " that is text, how could I
programically convert the value to 02/01/2008 in Date values

 
Reply With Quote
 
 
 
 
Gary''s Student
Guest
Posts: n/a
 
      16th Mar 2008
Sub qwerty()
s = "Feb '08 "
s = Application.WorksheetFunction.Substitute(s, "'", "20")
MsgBox (DateValue(s))
End Sub

--
Gary''s Student - gsnu200773


"wutzke" wrote:

> Given a cell value of "Feb '08 " that is text, how could I
> programically convert the value to 02/01/2008 in Date values
>
>

 
Reply With Quote
 
Leith Ross
Guest
Posts: n/a
 
      16th Mar 2008
On Mar 16, 7:19 am, wutzke <michael.wut...@gmail.com> wrote:
> Given a cell value of "Feb '08 " that is text, how could I
> programically convert the value to 02/01/2008 in Date values


Hello wutzke,

Here is one way. The single quote is represented by Chr$(39) for
readability.

Dim D

D = Split("Feb '08", Chr$(39))
D = CDate(D(0) & "1, " & D(1)) 'D is now = 2/01/2008

Sincerely,
Leith Ross
 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      16th Mar 2008
Or, staying totally within VBA, using this for your second line instead...

s = Replace(s, "'", "20")

Rick


"Gary''s Student" <(E-Mail Removed)> wrote in message
news:5A21F7F3-6E3C-4601-A3D8-(E-Mail Removed)...
> Sub qwerty()
> s = "Feb '08 "
> s = Application.WorksheetFunction.Substitute(s, "'", "20")
> MsgBox (DateValue(s))
> End Sub
>
> --
> Gary''s Student - gsnu200773
>
>
> "wutzke" wrote:
>
>> Given a cell value of "Feb '08 " that is text, how could I
>> programically convert the value to 02/01/2008 in Date values
>>
>>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting dates to current dates to find out the evaluation date Donica24 Microsoft Access Queries 1 26th Jan 2010 04:38 PM
Converting Julian Dates to regular dates =?Utf-8?B?Q0RUdWNzb24=?= Microsoft Excel Worksheet Functions 2 7th Jun 2007 04:20 AM
Converting Text dates into dates EAB1977 Microsoft Excel Programming 2 20th Jan 2006 04:20 PM
Re: Converting European dates to USA dates Fred Smith Microsoft Excel Misc 0 6th Sep 2003 12:27 AM
Re: Converting European dates to USA dates Bernard V Liengme Microsoft Excel Misc 0 5th Sep 2003 11:25 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:34 AM.