Thread: merge columns
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
dantuck dantuck is offline
external usenet poster
 
Posts: 1
Default merge columns

Hello,

This might do what you're after - but make sure the data starts in cell A1.

Dan.

Option Explicit

Sub ToOneColumn()

Dim cntI As Integer
Dim cntJ As Integer
Dim TotalRows As Integer
Dim TotalCols As Integer

TotalRows = ActiveSheet.UsedRange.Rows.Count
TotalCols = ActiveSheet.UsedRange.Columns.Count

For cntJ = 2 To TotalCols

Cells(1, cntJ).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Cut
Cells((cntJ - 1) * TotalRows + 1, 1).Select
ActiveSheet.Paste

Next cntJ

Cells(1, 1).Select

End Sub



"vlad" wrote:

I have 10+ columns of data. I need to have all columns merged one under
another into one column.For example column A. I can do it manually by cutting
the data in each column and pasting it below the last record in column A. But
there should be a way to automate that.Any help with the code will be
apprciated