vba - Macro combining multiple cells into one, with values separated by a comma -
in previous posted answer, combine multiple cells 1 in excel macro?, following macro provided..which works great way!
however, need separate cell values comma. have tried inserting comma between quotes "," not working. can please guide me resulting cell separate values comma? thank you!
sub joincells() set xjoinrange = application.inputbox(prompt:="highlight source cells merge", type:=8) xsource = 0 xsource = xjoinrange.rows.count xtype = "rows" if xsource = 1 xsource = xjoinrange.columns.count xtype = "columns" end if set xdestination = application.inputbox(prompt:="highlight destination cell", type:=8) if xtype = "rows" temp = xjoinrange.rows(1).value = 2 xsource temp = temp & " " & xjoinrange.rows(i).value next else temp = xjoinrange.columns(1).value = 2 xsource temp = temp & " " & xjoinrange.columns(i).value next end if xdestination.value = temp end sub
have here: http://www.excelforum.com/tips-and-tutorials/860240-concatall-udf-by-tigeravatar.html
the first post shows how use it, , 8th post recent version.
[edit] alternately, change both instances of & " " &
& "," &
Comments
Post a Comment