excel - CONCATENATE function with dynamic range -


i'd have concatenate function dynamic range. range can different, see example below. possible simple code?

example

the range intended rows only, number of non-empty cells in column different. need pair every 2 cells well, in example.

try - may need change c1 start of data

sub test() = 0 i2 = 0 activesheet     each cell in .range("c1:" & .range("c1").end(xldown).address)         i2 = 0         temp = ""         each c in .range(.cells(cell.row, 3), .cells(cell.row, 3).end(xltoright).address)             if = 0                 = 1             else 'every other column                 if i2 = 0 then'first each row needs no comma                     = 0                     temp = "(" & .cells(cell.row, -1 + c.column).value & "," & .cells(cell.row, 1 + c.column).value & ")"                 else                     = 0                     temp = temp & ",(" & .cells(cell.row, -1 + c.column).value & "," & .cells(cell.row, c.column).value & ")"                 end if                 i2 = i2 + 1             end if         next         .cells(cell.row, 1).value = temp 'put string column     next end end sub 

Comments