case inlist(h[i,4], T_DATE) if( empty(x) ) loop else x = dtos(x) _yy = left(x,4) _mm = substr(x,5,2) _dd = substr(x,7,2) x = '=date(' + _yy + ',' + _mm + ',' + _dd + ')' endif case inlist(h[i,4], T_DATETIME) if( empty(x) ) loop else x = ttoc(x,1) _yy = left(x,4) _mm = substr(x,5,2) _dd = substr(x,7,2) _hh = substr(x,9,2) _min = substr(x,11,2) _sec = substr(x, 13, 2) x = '=date(' + _yy + ',' + _mm + ',' + _dd + ')' ; + '+time(' + _hh + ',' + _min + ',' + _sec + ')' endif ..... endcase xlSheet.Cells[nRow,i].Value = x && you can set the numberformat as well xlsheet.Columns(i).NumberFormat = 'dd/mm/yyyy' && 'dd/mm/yyyy hh:mm:ss'