Free Support Forum -

Style Problem with dates

I have set the style.number property to 14 (Date), it apprears that the last cell that gets written out is still in general format and the cell shos the date as a number, not in date format. I am Setting the stlye before the putvalue:

cell.Style.Number = 14

cell = xlCells(CellLetter & (CellNumber + rowCounter))


Any help would be great


Well, you have to convert your string value to datetime value using the overloaded version of the method i.e., Cell.PutValue(stringval, isConverted), isConverted should be true if you want to automatically convert the value to its related format. I think you can try to change the line of code to:


cell.Style.Number = 14

cell = xlCells(CellLetter & (CellNumber + rowCounter))

cell.PutValue(ROL.Item(CellData(1)), True)

My Sample code:

Dim workbook As Workbook = New Workbook()
Dim worksheet As Worksheet = workbook.Worksheets(0)
Dim cells As Cells = worksheet.Cells
cells("A1").Style.Number = 14

Thank you.