Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
tom tom is offline
external usenet poster
 
Posts: 570
Default Stack columns from a matrix

I need a macro to take a 6 column, 6 row matrix, for instance, and stack the
columns 2 at a time on top of each other on another sheet in the spreadsheet.
If the columns were A-F, they would end up stacked
AB
CD
EF

Actually the matrix is about 52 columns by 419 rows with many blanks.

Thanks in advance for the help.
--
Tom
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Stack columns from a matrix


I used PasteSpecial to skip the blanks. sometimes it doesn't work like
you would expect if you are copying multiple columns. try this macro
first and see if you get good results. change the 10 below to the
number of columns you are using. If your last column of data is in Row
1 you can get the last column adding this to the code

LastCol = .cells(1,columns.Count).end(xltoleft).column

Then replace the 10 with LastCol



Sub Copycolumns()


With Sheets("Sheet1")
For ColCount = 1 To 10 Step 2
LastRow = .Cells(Rows.Count, ColCount).End(xlUp).Row
Set CopyRange = .Range(.Cells(1, LastRow), _
Cells(LastRow, ColCount + 1))
CopyRange.Copy

With Sheets("sheet2")
LastRow = .Cells(Rows.Count, "A").End(xlUp).Row
NewRow = LastRow + 1
Range("A" & NewRow).PasteSpecial _
Paste:=xlPasteValues, _
SkipBlanks:=True
End With
Next ColCount
End With


End Sub


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=172404

Microsoft Office Help

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I stack columns? Matheus Excel Programming 2 June 29th 07 10:22 PM
Stack & Cluster columns in same chart Chris Charts and Charting in Excel 2 October 24th 06 11:07 PM
stack columns Wan Excel Discussion (Misc queries) 1 December 26th 05 05:22 AM
How can I stack 3-D columns jiggiddi Charts and Charting in Excel 1 October 15th 05 04:39 AM
Multiple columns in stack graph Amanda Charts and Charting in Excel 8 August 6th 05 02:15 AM


All times are GMT +1. The time now is 06:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"