I have an Excel macro which imports a csv file with all the fields specified as text. Among these fields is a field whith a date. This fields appears as dd/mm/yyyy. When it comes to copy this field to another sheet converting it to date format yyyymmdd and later sort on the fields it does not work. Help is highly appreciated. Here is the code:
J
Code:
= J + 1 'is a acounter
Dim tdate As Date
Dim sDate As String
tdate = Sheets(SSource).Cells(I, ColE).Value 'from original imported file
sDate = Format(Tdate, "yyyymmdd")
Sheets(tName).Cells(J, ColA).Value = Tdate