我读了它,因为你想要所有的东西 在一个单列的列中进入另一个单元格。 这是一个例行程序, 它将从您指定的单元格中收集所有数据, 并连接所有的东西, 直到数据中断 。
Option Explicit
Function ColConc(CellRef As Range, Delimiter As String)
Dim LoopVar As Long
Dim StartRow As Long
Dim EndRow As Long
Dim Concat As String
Dim Col As Long
Col = CellRef.column
StartRow = CellRef.Row
EndRow = CellRef.End(xlDown).Row
Concat = ""
For LoopVar = StartRow To EndRow
Concat = Concat & Cells(LoopVar, Col).Value
If LoopVar <> EndRow Then Concat = Concat & Delimiter
Next LoopVar
ColConc = Concat
End Function
call by using the formula =ColConc(A2," ")
and this will get everything from cell A2, down to the end of that column, with a space as the delimiter.
The delimiter can be any string, so you can place anything between the data. A blank cell ends the data it uses for concatenating into a single string.
It will only work on the current sheet - more coding would be needed to get that part working