Thread: combine columns
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_453_] Leith Ross[_453_] is offline
external usenet poster
 
Posts: 1
Default combine columns


Hello Tom,

This will combine data in the range of "A1:C25" ( you can change thi
to match your needs) and overwrite the data in column "A" as a singl
column.


Code
-------------------

Sub CombineColumns()

Dim Cell
Dim I As Long
Dim Rng As Range
Dim Temp()

ReDim Temp(0)
Set Rng = ActiveSheet.Range("A1:C25")

For Each Cell In Rng
I = I + 1
ReDim Preserve Temp(I)
Temp(I) = Cell
Next Cell

Rng.ClearContents
For I = 1 To UBound(Temp, 1)
ActiveSheet.Cells(I, "A").Value = Temp(I)
Next I

End Sub

-------------------

--
Leith Ros

-----------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=49721