• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA code for selecting data within a date range

Cameron

New Member
Hello,
Please excuse my VBA, it's terrible.

But I have a bar chart in Excel at the moment I have the following code to add a series:
If Sheets("Intro").OLEObjects("Checkbox1").Object.Value = True Then
Sheets("Intro").ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(1).Values = Sheets("T_Monthly_Data").Range("E$8:BM$8")

The second range is blank so if checkbox is not selected it goes blank.

Now I would like the user to be able to select a start date and an end date and for the graphic to be able to automatically resize the x-axis and display only the data that relates to their query.
I would then like to repeat that so I can add additional series. Something like:
If Sheets("Intro").OLEObjects("Checkbox2").Object.Value = True Then
Charts("Chart1").SeriesCollection.Add _
Source:=ActiveWorkbook.Worksheets("T_Monthly_Data").Range("E$9:BM$9")

Any help would be appreciated!!

Thank you
 
@Cameron

Firstly, Welcome to the Chandoo.org Forums

Why not use Named Formula for the chart and do all the work in the Named Formula

Posting a sample file would also help us help you
 
Back
Top