W wutzke Mar 16, 2008 #1 Given a cell value of "Feb '08 " that is text, how could I programically convert the value to 02/01/2008 in Date values
Given a cell value of "Feb '08 " that is text, how could I programically convert the value to 02/01/2008 in Date values
G Gary''s Student Mar 16, 2008 #2 Sub qwerty() s = "Feb '08 " s = Application.WorksheetFunction.Substitute(s, "'", "20") MsgBox (DateValue(s)) End Sub
Sub qwerty() s = "Feb '08 " s = Application.WorksheetFunction.Substitute(s, "'", "20") MsgBox (DateValue(s)) End Sub
L Leith Ross Mar 16, 2008 #3 Given a cell value of "Feb '08 " that is text, how could I programically convert the value to 02/01/2008 in Date values Click to expand... 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
Given a cell value of "Feb '08 " that is text, how could I programically convert the value to 02/01/2008 in Date values Click to expand... 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
R Rick Rothstein \(MVP - VB\) Mar 16, 2008 #4 Or, staying totally within VBA, using this for your second line instead... s = Replace(s, "'", "20") Rick
Or, staying totally within VBA, using this for your second line instead... s = Replace(s, "'", "20") Rick