Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I stack columns? | Excel Programming | |||
Stack & Cluster columns in same chart | Charts and Charting in Excel | |||
stack columns | Excel Discussion (Misc queries) | |||
How can I stack 3-D columns | Charts and Charting in Excel | |||
Multiple columns in stack graph | Charts and Charting in Excel |