PC Review


Reply
Thread Tools Rate Thread

How do I stack columns?

 
 
=?Utf-8?B?TWF0aGV1cw==?=
Guest
Posts: n/a
 
      29th Jun 2007
Hi, I've got the following table:
Site Product Line Sub-division General Turnover YTD 2007 .....
abc abcd xyz 123 456
lkj lkjh uio 897 589

For each Site there are 13 metrics (columns: D, F, H, J....) and also an
Year to Date value for each of the 13 metrics in colunmns E, G, I ...). I
would like to stack Column D to AC by Site on a Table like this:

Site Product Line Sub-division Metric YTD 2007
abc abcd xyz (info column D) (Info column E)
abc abcd xyz (Info column F) (Info Column G)

Can somebody help me?
 
Reply With Quote
 
 
 
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      29th Jun 2007
Try code below. If you have a header row then change RowCount from 1 to 2

Sub stackcol()

Application.CutCopyMode = False
RowCount = 1
Do While Not IsEmpty(Cells(RowCount, "A"))


Rows((RowCount + 1) & ":" & (RowCount + 12)). _
Insert Shift:=xlDown
Range(Cells(RowCount, "A"), Cells(RowCount, "C")).Copy _
Destination:=Range(Cells(RowCount + 1, "A"), _
Cells(RowCount + 12, "A"))
FirstRow = RowCount
RowCount = RowCount + 1
For CopyCount = 0 To 11

Range(Cells(FirstRow, "F"), Cells(FirstRow, "G")). _
Offset(0, 2 * CopyCount).Copy _
Destination:=Cells(RowCount, "D")

RowCount = RowCount + 1
Next CopyCount

Range(Cells(FirstRow, "F"), Cells(FirstRow, "AC")) = ""
Loop

End Sub

"Matheus" wrote:

> Hi, I've got the following table:
> Site Product Line Sub-division General Turnover YTD 2007 .....
> abc abcd xyz 123 456
> lkj lkjh uio 897 589
>
> For each Site there are 13 metrics (columns: D, F, H, J....) and also an
> Year to Date value for each of the 13 metrics in colunmns E, G, I ...). I
> would like to stack Column D to AC by Site on a Table like this:
>
> Site Product Line Sub-division Metric YTD 2007
> abc abcd xyz (info column D) (Info column E)
> abc abcd xyz (Info column F) (Info Column G)
>
> Can somebody help me?

 
Reply With Quote
 
=?Utf-8?B?TWF0aGV1cw==?=
Guest
Posts: n/a
 
      29th Jun 2007
Hey Joel, Thanks a lot!
It works great!

"Joel" wrote:

> Try code below. If you have a header row then change RowCount from 1 to 2
>
> Sub stackcol()
>
> Application.CutCopyMode = False
> RowCount = 1
> Do While Not IsEmpty(Cells(RowCount, "A"))
>
>
> Rows((RowCount + 1) & ":" & (RowCount + 12)). _
> Insert Shift:=xlDown
> Range(Cells(RowCount, "A"), Cells(RowCount, "C")).Copy _
> Destination:=Range(Cells(RowCount + 1, "A"), _
> Cells(RowCount + 12, "A"))
> FirstRow = RowCount
> RowCount = RowCount + 1
> For CopyCount = 0 To 11
>
> Range(Cells(FirstRow, "F"), Cells(FirstRow, "G")). _
> Offset(0, 2 * CopyCount).Copy _
> Destination:=Cells(RowCount, "D")
>
> RowCount = RowCount + 1
> Next CopyCount
>
> Range(Cells(FirstRow, "F"), Cells(FirstRow, "AC")) = ""
> Loop
>
> End Sub
>
> "Matheus" wrote:
>
> > Hi, I've got the following table:
> > Site Product Line Sub-division General Turnover YTD 2007 .....
> > abc abcd xyz 123 456
> > lkj lkjh uio 897 589
> >
> > For each Site there are 13 metrics (columns: D, F, H, J....) and also an
> > Year to Date value for each of the 13 metrics in colunmns E, G, I ...). I
> > would like to stack Column D to AC by Site on a Table like this:
> >
> > Site Product Line Sub-division Metric YTD 2007
> > abc abcd xyz (info column D) (Info column E)
> > abc abcd xyz (Info column F) (Info Column G)
> >
> > Can somebody help me?

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stack columns from a matrix Tom Microsoft Excel Programming 0 22nd Jan 2010 01:40 AM
Stack & Cluster columns in same chart =?Utf-8?B?Q2hyaXM=?= Microsoft Excel Charting 2 24th Oct 2006 11:07 PM
stack columns =?Utf-8?B?V2Fu?= Microsoft Excel Misc 1 26th Dec 2005 05:22 AM
How can I stack 3-D columns =?Utf-8?B?amlnZ2lkZGk=?= Microsoft Excel Charting 1 15th Oct 2005 04:39 AM
Multiple columns in stack graph =?Utf-8?B?QW1hbmRh?= Microsoft Excel Charting 8 6th Aug 2005 02:15 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:49 PM.