vba - Combine Two Rows in Excel -
i have 2 rows in excel sheet . columns identical except one.something
how can achieve ? not familiar pivot concept.
any ?
regards.
hope want:
sub quickcombine() dim x() dim y() dim objdic object dim lngrow long dim lngcol long dim ws worksheet x = range([a1], cells(rows.count, "g").end(xlup)) y = x set objdic = createobject("scripting.dictionary") lngrow = 1 ubound(x, 1) if not objdic.exists(lcase$(x(lngrow, 1) & x(lngrow, 2))) objdic.add lcase$(x(lngrow, 1) & x(lngrow, 2)), lngrow else y(lngrow, 1) = vbnullstring y(objdic.item(lcase$(x(lngrow, 1) & x(lngrow, 2))), 3) = y(objdic.item(lcase$(x(lngrow, 1) & x(lngrow, 2))), 3) & "," & x(lngrow, 3) end if next set ws = sheets.add [a1].resize(ubound(x, 1), ubound(x, 2)) = y columns("a").specialcells(xlblanks).entirerow.delete end sub
got here.
Comments
Post a Comment