回復 1#aoss98
Sub Ex()
Dim C As Range
For Each C In Range("B:B").SpecialCells(xlCellTypeConstants).Areas
C.Cells(1, 2) = Join(Application.Transpose(C), ",")
Next
End Sub作者: aoss98 時間: 2011-4-19 21:35
謝謝 GBKEE 指教, 當程式執行這句便中止 For Each C In Range("c:c").SpecialCells(xlCellTypeConstants).Areas
另外 如果只有一列資料,執行 oobird 程式碼便出現以下結果
A 欄 B欄 C欄
123456 34 34,36
小弟借oobird版大的程式碼稍作修改
Sub yy()
i = 1
Do
aa = Cells(i, 2).CurrentRegion.Rows.Count
b = Cells(i, 2).Resize(aa, 1)
If aa = 1 Then
Cells(i, 3) = b
Else
Cells(i, 3) = Join(Application.Transpose(b), ",")
End If
i = i + aa + 1
Loop Until Cells(i, 2) = ""
End Sub作者: aoss98 時間: 2011-4-20 00:09