PDA

View Full Version : [SOLVED:] VBA Code for Combining Multiple Columns into One Column - Excel for Mac



mbrio
08-06-2014, 12:41 PM
Hi there,

I want a VBA code for combining multiple columns into one column in Excel.

The data I want to convert is as follows:

AA EE II
BB FF JJ
CC GG KK
DD HH LL

And I want a VBA code to convert it as follows:

AA
BB
CC
DD
EE
FF
GG
HH
II
JJ
KK
LL

Thanks so much!

jolivanes
08-06-2014, 01:42 PM
Sub Maybe()
Dim lc As Long, j As Long
lc = Cells(1, Columns.Count).End(xlToLeft).Column '<----- Assumes data starts in row 1, column A
For j = 1 To lc
ActiveSheet.UsedRange.Columns(j).Copy Sheets(3).Range("A" & Rows.Count).End(xlUp).Offset(1) '<---- copies into 3rd sheet, column A
Next j
End Sub

mbrio
08-06-2014, 02:25 PM
It works perfect!!!

Thanks jolivans!!!:)

jolivanes
08-06-2014, 02:32 PM
Glad it works for you.
Good luck