VBA Chart Axis Values Stopping One Short

BrianExcel

Well-known Member
Joined
Apr 21, 2010
Messages
975
The following code is working perfectly to set axis and create a chart with the exception of ONE line apparently...

VBA Code:
                With ActiveChart
                    .ChartTitle.Select
                    .ChartTitle.Text = "Ball Edit Percentage"
                    Selection.Format.TextFrame2.TextRange.Characters.Text = "Ball Edit Percentage" & vbCrLf & res
                
                    .Axes(xlCategory).AxisTitle.Select
                    .Axes(xlCategory, xlPrimary).AxisTitle.Text = "Venue"
                    Selection.Format.TextFrame2.TextRange.Characters.Text = "Venue" & vbCrLf & sChartTitle2

                    .FullSeriesCollection(1).XValues = "='7DayEdits'!$A$2:$A$55"
                    .Axes(xlCategory).Select
                    Selection.TickLabels.Orientation = xlUpward
                End With
            Next i2
        End If
    Next sh

The line not working is seventh from the bottom..

Code:
.FullSeriesCollection(1).XValues = "='7DayEdits'!$A$2:$A$55"

Actually, as written it works fine - it's selecting the proper values. But I need it to dynamically choose the cells based on how many are in the column. The data is in a table, so I've been trying to reference the header to select the column. The second axis works fine and selects all the right data, but for some reason that one line starts in row2 instead of row 1 (header) and ends one short of the end of the table dataset.

Any thoughts how I can more dynamically set that range? The number of values in that range will change, so having a preset line of code to reference it won't work long-term.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Couldn't you get the last row or whatever values you needed and add it in the string..

VBA Code:
.FullSeriesCollection(1).XValues = "='7DayEdits'!$A$2:$A$" & lrow
 
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