vba - Splitting multi value cells in Excel into rows -
i encountered problem in excel, i'm planning split multi-valued cell rows through vba.
this current table
then i'm trying make this
thank you
this want. i'm assuming 'emails' column column b , start on row 1.
option explicit const analysis_row string = "b" const data_start_row long = 1 sub replicatedata() dim irow long dim lastrow long dim ws worksheet dim isplit() string dim iindex long dim isize long 'application.screenupdating = false application.calculation = xlcalculationmanual thisworkbook .worksheets("sheet1").copy after:=.worksheets("sheet1") set ws = activesheet end ws lastrow = .cells(.rows.count, analysis_row).end(xlup).row end irow = lastrow data_start_row step -1 isplit = split(ws.cells(irow, analysis_row).value2, ",") isize = ubound(isplit) - lbound(isplit) + 1 if isize = 1 goto continue ws.rows(irow).copy ws.rows(irow).resize(isize - 1).insert iindex = lbound(isplit) ubound(isplit) ws.cells(irow, analysis_row).offset(iindex).value2 = isplit(iindex) next iindex continue: next irow application.cutcopymode = false application.calculation = xlcalculationautomatic 'application.screenupdating = true end sub
Comments
Post a Comment