Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default How do I stack columns?

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default How do I stack columns?

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?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default How do I stack columns?

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
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
Stacked Columns - Order of Stack jaygreg Charts and Charting in Excel 1 July 23rd 07 03:28 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 02:27 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"