Format of the date field in excel after export

Hi All,

I am using the Export to Excel script from the sandbox by Ken Pepsica. I have two columns that have date fields in a view. I inserted the following code in the DoView Export sub

to format the dates in the Excel.

But it works and formats well in one column of the Excel bot not the other. When I debug the arrCellValues(x) has the correct date format for the both the column values But after exporting the row to excel one column keeps the formatted value but the other does not.

In Excel one column has the correct 04/04/2008 05:10:44 PM

The other column has the format 3/24/2008 13:24

   If Isdate(vtColumnValue) Then



    excelSheet.Columns(x).NumberFormat = "mm/dd/yyyy hh:mm:ss AM/PM" 

    

    End If

   

   arrCellValues(x) = vtColumnValue        

Can somebody answer.