Hi everyone,

I'm not a Excel person, below is the code is something i came out with after google for few days... I need something better than this.


Sub Work1()
'Day1 chart1
With ActiveSheet.ChartObjects.Add _
(Left:=300, Width:=450, Top:=50, Height:=220)
Range("B2:D51").Select
.Chart.SetSourceData Source:=Range("'Sheet1'!$B$2:$D$51")
.Chart.ChartType = xlLine
.Chart.PlotArea.Select
.Chart.SeriesCollection(1).Name = "=""Processor"""
.Chart.SeriesCollection(2).Name = "=""Memory"""
.Chart.SetElement (msoElementChartTitleAboveChart)
.Chart.ChartTitle.Text = "=Sheet1!A2"
.Chart.ChartArea.Select
End With
End Sub


I'm looking for a macro that can automatically create charts by looping through date and time instead of specifying the range (column and row) manually as above.

Here is the sample data.

column A - date
column B - time
column C – time_spent
column D – time_used

Date Time % Time_Spent %Time_Used
6/21/2011 0:00:00 45.00% 80.16%
6/21/2011 0:15:00 10.00% 70.38%
6/21/2011 0:30:00 30.40% 88.36%
6/22/2011 0:00:00 15.15% 34.16%
6/22/2011 0:15:00 80.00% 21.38%
6/23/2011 0:30:00 10.40% 33.36%
6/24/2011 0:00:00 11.15% 44.16%

Please advice Thank you so much!

SL