我想通過數據(simular到如下所示)進行迭代存儲在不同的小區和將它們組合成一個新行(CHR(10))分隔的單個細胞進行迭代。 需要導入一個單元格的數據量將會改變。串聯,並通過多種細胞VBA的excel
2991
19391
423
435
436
代碼需要通過整個片來迭代無論任何線斷裂。所需的格式是:
2991 - all three cells would be combined into one cell in the next column to this one.
19391
423
-Line space, this will need to be taken into account and is the seperator of data.
26991 - all four cells would be combined into one cell in the next column to this one.
19331
424
6764
下面是我這麼遠,它需要的列到當前行的左邊,並結合它,這是錯誤的。
Sub ConcatColumns()
Do While ActiveCell <> "" 'Loops until the active cell is blank.
ActiveCell.Offset(0, 1).FormulaR1C1 = _
ActiveCell.Offset(0, -1) & chr(10) & ActiveCell.Offset(0, 0)
ActiveCell.Offset(1, 0).Select
Loop
End Sub
非常感謝! – Chris