excel - Optimizing a date conversion loop -
i have set of data (n), 1500 items long filled dates in dd.mm.yyyy format excel not regognize. goal change them excel can work with, how it.
function date_to_excel() call public_dims dim date_i string date_array = thisworkbook.sheets("spread").range(cells(7, 5), cells(7 + n, 5)) = 0 n date_i = thisworkbook.sheets("spread").cells(7 + i, 5) if date_i <> "" date_array = split(date_i, ".") date_i = date_array(1) & "/" & date_array(0) & "/" & date_array(2) thisworkbook.sheets("spread").cells(7 + i, 5) = date_i end if next end function
the function works allright, takes long time. what askingfrom community ideas on how optimize loop. have tried adding entire range dates array , looking through that, doesn't seem compatible method of changing date format (the date_i = line near end).
you can use text columns functionality dmy column format.
thisworkbook.sheets("spread").range("e7:e" & 7 + n).texttocolumns _ datatype:=xldelimited, fieldinfo:=array(1, xldmyformat)
Comments
Post a Comment