Chart only Using First Table Value for a Range

BrianExcel

Well-known Member
Joined
Apr 21, 2010
Messages
975
The following code is successfully generating a chart from the table I have on the sheet...

VBA Code:
Range("Sum7EditsTable[[#All],[Venue]]").Select
ActiveWorkbook.Names.Add Name:="VenueColumn", RefersToR1C1:="=Sum7EditsTable[[#All],[Venue]]"
Range("Sum7EditsTable[[#All],[Percent Edit]]").Select
ActiveWorkbook.Names.Add Name:="PercentColumn", RefersToR1C1:="=Sum7EditsTable[[#All],[Percent Edit]]"

ActiveWorkbook.ActiveSheet.Shapes.AddChart(201, xlColumnClustered).Select
ActiveChart.ApplyChartTemplate ("C:\Users\brian.burdette\AppData\Roaming\Microsoft\Templates\Charts\OpsReviewHistogramTemplate.crtx")

In looking closer, however, the y axis (bottom) is numbering each value as 1, 2, 3 instead of incorporating the actual values in column 1 (the y axis).

WHat do I need to do to have my values represent the y axis instead of just the title?
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Some generic VBA working with charts
VBA Code:
    Set objChart = ActiveSheet.ChartObjects.Add(10, 10, 600, 450)
    With objChart.Chart
        .SeriesCollection.Add (ActiveSheet.Range("A1"))
        .SeriesCollection(1).XValues = rDateRange
        .SeriesCollection(1).Values = rOEERange
        .PlotBy = xlColumns
        .ChartArea.AutoScaleFont = False
        .ChartType = xlBarStacked
        .HasTitle = True
        .ChartTitle.Characters.Text = "My Title"
        .ChartTitle.Font.Bold = True
        .ChartTitle.Font.Size = 12
    End With

For your specific question
VBA Code:
    Set objChart = ActiveSheet.ChartObjects(1)
     With objChart.Chart
         .SeriesCollection(1).XValues = Range("Sum7EditsTable[[#All],[Venue]]")
         .SeriesCollection(1).Values = Range("Sum7EditsTable[[#All],[Percent Edit]]")
    End With
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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