excel - A cell has 3 inserted lines of data. How to split it into rows for each line of data -


2 lines of dates (it anything) in cell. need detect entries in cell separated \n (new line?), , have function split cell each line entry.

so imagine somewhere detect character new line (\n or else) , there start create new cells grabbing data detected before \n

enter image description here

assuming data in column a , want output splitting data in column c, following might helpful:

option explicit  sub splitcell()     dim lastrow long, rowind long, long     dim temparr variant     dim ws worksheet      set ws = thisworkbook.sheets("sheet1")  'change sheet1 worksheet      ws         rowind = 1         lastrow = .cells(.rows.count, "a").end(xlup).row    'get last row data in column         = 1 lastrow    'looping tgrough cells in column             temparr = split(.range("a" & i), chr(10))   'chr(10) line break code             .range("c" & rowind).resize(ubound(temparr) + 1, 1) = application.transpose(temparr)             rowind = rowind + ubound(temparr) + 1         next     end end sub 

see image reference.

enter image description here


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -