ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need help to convert date from dd/mm/yyyy to mm/dd/yyyy (https://www.excelbanter.com/excel-programming/388114-need-help-convert-date-dd-mm-yyyy-mm-dd-yyyy.html)

kiwis

Need help to convert date from dd/mm/yyyy to mm/dd/yyyy
 
Hi

I need help in converting date which is in dd/mm/yyyy to mm/dd/yyyy
format.

I need to write a macro that will convert column B which holds the
date to
the correct format mm/dd/yyyy & write back to same column B but in new
format.

sample data
orginal data converted data
B B(mm/dd/yyyy)
19/12/2002 12/19/2002
15/12/2001 12/15/2001

Thank you for providing any ideas.

rgds
kiwis


Norman Jones

Need help to convert date from dd/mm/yyyy to mm/dd/yyyy
 
Hi Kiwis,

Try something like:

'=============
Public Sub Tester()
Dim WB As Workbook
Dim SH As Worksheet
Dim Rng As Range
Dim iRow As Long

Set WB = Workbooks("Book1")
Set SH = WB.Sheets("Sheet2")

With SH
iRow = .Range("B" & Rows.Count).End(xlUp)
Set Rng = .Range("B1:B" & iRow)
End With

Rng.NumberFormat = "mm/dd/yy"

End Sub
'<<=============


---
Regards,
Norman


"kiwis" wrote in message
oups.com...
Hi

I need help in converting date which is in dd/mm/yyyy to mm/dd/yyyy
format.

I need to write a macro that will convert column B which holds the
date to
the correct format mm/dd/yyyy & write back to same column B but in new
format.

sample data
orginal data converted data
B B(mm/dd/yyyy)
19/12/2002 12/19/2002
15/12/2001 12/15/2001

Thank you for providing any ideas.

rgds
kiwis





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com