View Full Version : [SOLVED:] How to Code to accomplish this in Excel Chart?
gnaga
02-05-2005, 05:37 AM
I have an excel chart which shows the trend of few years data of a particular parameter. The data collected is everyday. I would like to have different x-axis interval of 1, 2, 5, 10, 15, 20, & 30 days for the total span.
How to accomplish this using VBA?
TIA
GNaga
Jacob Hilderbrand
02-05-2005, 10:59 PM
So you want to have a chart with 1 day intervals, then one with 2 day intervals, then one with 5 day intervals etc. and have them rotate with VBA? Or do you want to do something else?
Can you post an attachment that shows how your data is layed out?
gnaga
02-07-2005, 06:02 AM
Thanks for your reply.
By creating few chart and rotating is one way of accomplishing my requirement. Is it possible to do that with one chart? I mean I will put a list box in that chart and select the interval I want.
I have not yet created the one. I am in the brain storming session.
GNaga
Jacob Hilderbrand
02-07-2005, 06:22 AM
Are you trying to do something like this?
Option Explicit
Private Sub OptionButton1_Click()
Me.ChartObjects("Chart 1").Activate
ActiveChart.SetSourceData _
Source:=Sheets("Chart Data").Range("A1:B31"), PlotBy:=xlColumns
End Sub
Private Sub OptionButton2_Click()
Me.ChartObjects("Chart 1").Activate
ActiveChart.SetSourceData _
Source:=Sheets("Chart Data").Range("D1:E16"), PlotBy:=xlColumns
End Sub
Private Sub OptionButton3_Click()
Me.ChartObjects("Chart 1").Activate
ActiveChart.SetSourceData _
Source:=Sheets("Chart Data").Range("G1:H7"), PlotBy:=xlColumns
End Sub
Refer to the attachment.
gnaga
02-07-2005, 06:37 AM
Thanks for your prompt reply. Yes Your idea can be of immense help to me to start with. Without that I was confused with how to start. Now I can confidently proceed further to make it perfectly the way I want.
Again Thanks for your time and effort.
GNaga
Jacob Hilderbrand
02-07-2005, 07:00 AM
You're Welcome :beerchug:
Take Care
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.