View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Javed Javed is offline
external usenet poster
 
Posts: 91
Default Convert 24/03/2010 date into 03/24/2010 date format

On Jun 5, 9:34*am, Nitesh wrote:
Hi ,

I’m using Ms Excel 2003 and in my excel sheet there is a column in which
dates are entered as DD/MM/YYYY (e.g. 24/03/2010 as a text) format and I
wanted to convert it into MM/DD/YYYY (e.g. 03/24/2010).

Can excel programming is required to convert such date or is there any excel
function.

Please suggest.

--
------------------------------
Thanks
Nitesh
------------------------------


You can use following code.

Just paste the following in any standard module.Call like any other
function from Function Wizard (It will be in Usedr Defined Category)

Function DateConvert(dte As String, Optional sep As String = ".")
Dim fstpos As Integer, sndpos As Integer
fstpos = InStr(1, dte, sep, vbTextCompare)
sndpos = InStr(1 + fstpos, dte, sep, vbTextCompare)
DateConvert = DateSerial(Mid(dte, sndpos + 1, 50) _
, Mid(dte, fstpos + 1, sndpos - fstpos - 1) _
, Left(dte, fstpos - 1))
End Function


You may use excel function Mid,Date,Right,Left but that will be a
large one.