excel - copy specific columns from rows with duplicate data -
trying in excel, end-user not have ms access (which make billion times easier...).
i have sheet rows of data like:
ticket date name comments 52 1/1/2016 edgar did thing 52 1/1/2016 edgar did thing b 52 1/2/2016 edgar did thing c 60 1/5/2016 steph looked @ x 60 1/5/2016 steph looked @ y i need write formula (or vba macro) loop through rows , concatenate comments based on ticket #. i.e. in above example end result be:
ticket date name comments 52 1/1/2016 edgar did thing a, did thing b, did thing c 60 1/5/2016 steph looked @ x, looked @ y i've tried looking through similar questions, haven't found i've been able manipulate suit needs.
would love hear experts think. sheet reconciled monthly, , of varying length.
this should trick:
sub main() dim wb workbook dim ws worksheet dim long, j long set wb = thisworkbook set ws = wb.sheets("sheet1") ' change name of sheet lastrow = ws.cells(rows.count, 1).end(xlup).row ws j = 2 ' start loop @ row 2 while not isempty(.cells(j, 1)) = lastrow 2 step -1 if j <> , .cells(j, 1) = .cells(i, 1) .cells(j, 4) = .cells(j, 4) & "," & .cells(i, 4) .rows(i).entirerow.delete end if next j = j + 1 loop end end sub
Comments
Post a Comment