NatetheGreat
Active Member
- Joined
- Nov 18, 2013
- Messages
- 268
Hello,
I currently have a beautiful bit of code assigned to a scrollbar, that was suggested to me here on Mr.Excel. Thanks to all the Gurus out their for their continual support and assistance.
Each of these cases call a very similar sub, which are just resizing the range of a series on the active chart
there are 5 in all... each of these adjusting the range of the chart to different sections of the data series.
this works great, but does anyone know what the code would be to apply the same logic to a different chart which had not just one, but 3 series within it? All three series are linked to the same table which the same x-axis values, just looking to adapt
So that it will re-size (split in half) three series instead of just the one.
Thanks so much !
I currently have a beautiful bit of code assigned to a scrollbar, that was suggested to me here on Mr.Excel. Thanks to all the Gurus out their for their continual support and assistance.
Code:
Sub Scrollbar1_Change()
Select Case ActiveSheet.ScrollBars("Scroll bar 3").Value
Case "0"
Call FullChartDataRange
Case "1"
Call HalfChartDataRange
Case "2"
Call QuarterChartDataRange
Case "3"
Call eighthChartDataRange
Case "4"
Call SixteenthChartDataRange
End Select
End Sub
Each of these cases call a very similar sub, which are just resizing the range of a series on the active chart
Code:
Sub HalfChartDataRange()
Dim Rng As Range
ActiveSheet.ChartObjects("Rolling Position").Activate
Set Rng = Sheets("Raw Data").Range("Stats[RollPos]")
ActiveChart.SetSourceData Source:=Rng.Resize(Rng.Rows.Count / 2)
End Sub
Sub QuarterChartDataRange()
Dim Rng As Range
ActiveSheet.ChartObjects("Rolling Position").Activate
Set Rng = Sheets("Raw Data").Range("Stats[RollPos]")
ActiveChart.SetSourceData Source:=Rng.Resize(Rng.Rows.Count / 4)
End Sub
there are 5 in all... each of these adjusting the range of the chart to different sections of the data series.
this works great, but does anyone know what the code would be to apply the same logic to a different chart which had not just one, but 3 series within it? All three series are linked to the same table which the same x-axis values, just looking to adapt
Code:
Set Rng = Sheets("Raw Data").Range("Stats[RollPos]")
ActiveChart.SetSourceData Source:=Rng.Resize(Rng.Rows.Count / 2)
So that it will re-size (split in half) three series instead of just the one.
Thanks so much !