Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Converting Dates

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Converting Dates

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default Converting Dates

On Mar 16, 7:19 am, 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


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
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Converting Dates

Or, staying totally within VBA, using this for your second line instead...

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

Rick


"Gary''s Student" wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
converting Dates torpido Excel Worksheet Functions 2 January 27th 15 10:24 AM
Converting to Dates Trazza_UK Excel Discussion (Misc queries) 5 November 1st 07 10:33 PM
Converting Julian Dates to regular dates CDTucson Excel Worksheet Functions 2 June 7th 07 04:20 AM
Converting Text dates into dates EAB1977 Excel Programming 2 January 20th 06 04:20 PM
converting dates mike Excel Programming 2 February 19th 04 11:31 PM


All times are GMT +1. The time now is 01:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"