I would like to turn values in given range into VBA string where original cell values are separated by any chosen column delimiter and row delimiter. Delimiters could be one
Here's a quick way to test (Note: this will only work with Excel 2016 (or if you have the TextJoin()
function).
First, in the empty column D, do =C1&"@"
, so you get your last column filled with the cell+@
Then, say in cell E1, =TEXTJOIN(",",TRUE,A1:C5)
(Note: TRUE
there means to skip blanks. If you have blanks, and want to keep them, change that to FALSE
).
THen, on that cell, run
=Substitute(E1,"@,","@")
Or combine the formulas into one: =SUBSTITUTE(TEXTJOIN(",",TRUE,A1:C4),"@,","@")
.
If you need vba, just throw the formula into a VBA macro and run like that.