View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tim Williams Tim Williams is offline
external usenet poster
 
Posts: 1,588
Default Macro to combine data in a column

Do you want to clear all of the other cells?

Sub test()
Dim c As Range
Dim s As String

For Each c In Selection
s = s & IIf(s = "", "", Chr(10)) & c.Value
Next c

Selection.Cells.Value = ""
Selection.Cells(1).Value = s
End Sub


Tim.


"Janna" wrote in message
...
If I select a block of contiguous cells in the same column, is it
possible to
create a macro that will combine all the data, in the order of top
selected
cell to the bottom selected cell and place it in proper order into a
single
cell (the top cell of the selected block)--I don't want to merge the
cells, I
just want all the data from a block of selected cells to be placed
into one
cell.

Thanks.