I'm trying to open a list of csv file and copy the data into different spreadsheets of a excel file. My script is as follows
Sub importcsv()
Dim strFile As String
Dim strCSV As String
strFile = "D:\15049"
strCSV = "A4260512_ECRec.csv"
Workbooks.Open Filename:=strFile & "\" & strCSV
Range("A1").CurrentRegion.Copy Destination:=Workbooks("test 150302.xlsm").Sheets("test2").Range("A1")
Workbooks(strCSV).Close
End Sub
The problem I have is in my csv file there is one colume of date time data (dd/mm/yyyy hh:mm), when copying those to excel, some are copied in the right order, some are not. For example, 31/3/1990 is copied exactly but 1/4/1990 is copied as 4/1/1990. In my region setting, date format is set as d/mm/yyyy.
Anyone has any idea? Please help.
Thanks,
Aucun commentaire:
Enregistrer un commentaire