Complete Stacked Column Chart in Excel 2007

Burdette

Board Regular
Joined
Mar 26, 2007
Messages
143
I want to make a complete Stacked Column chart in Excel 2007. Each stack in the stacked column chart should contain (1) the name of the stack, (2) the number represented by the stack, and (3) the % the number is of the total. Hope someone can help the old man.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
.
.

Try something like this:

Code:
Sub AddStackedColumnChart()

    Dim SourceData As Range
    Dim Cht As Shape
    
    'Exit if active sheet is not a worksheet
    If TypeName(ActiveSheet) <> "Worksheet" Then Exit Sub
    
    With ActiveSheet
        Set SourceData = .Range("A1:D4") 'Set source data for chart
        Set Cht = .Shapes.AddChart  'Add chart
    End With
    
    'Customize chart
    With Cht.Chart
        .ChartType = xlColumnStacked
        .SetSourceData Source:=SourceData
        .ApplyDataLabels
    End With
    
End Sub
 
Upvote 0
Thanks...I am not very good with coding, but I do use simple stuff and this gives me a chance to try learning soemthing new..
 
Upvote 0
.
.

No problem. I've only been learning for 6 months or so.

The key is recording your actions and trying to understand/refine the generated code. Also, reading some of the following books will give you a real insight.

Excel VBA Programming For Dummies by John Walkenbach
Excel Power Programming with VBA by John Walkenbach
 
Upvote 0
Thnaks...I know the Statistics for Dummies for statstica is a good book - never thought of Programming for Dummies.
Truth is I have the stacked column chart perfect Except I do not have the % of the stack However I played around with is so much to get where I want it, I am not sure I could do it again -I did not use programming, just funcations within Excel 2007 to get what I have.

Guess I will have to get a book.

BTW - if you have only been doing this for 6 months you have accomplished a great deal- Congradualations.
 
Upvote 0

Forum statistics

Threads
1,213,511
Messages
6,114,054
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top