Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default linechart through vb script

I am trying to create linechart through vb script

here is my data

06:00 200 05/01/2009
06:30 250 05/01/2009
07:00 300 05/01/2009
07:30 450 05/01/2009
....
....
.....
...

06:00 130 05/02/2009
06:30 220 05/02/2009
07:00 320 05/02/2009
07:30 450 05/02/2009
....
.....
......


This is my spreadsheet, to start with I am taking only two days

trying to draw line chart to display how pattern is

here is my code

ActiveWorkbook.Charts.Add
With ActiveWorkbook.ActiveChart
.ChartType = xlLineStacked
Dim i As Integer
Dim j As Integer
Dim rn As String
Dim rn2 As String
Dim TIT As String
Dim k As Integer
i = 2
k = 0
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:C61"),
PlotBy :=xlColumns

' xlsAxisCategory = .Axes(, Excel.XlAxisGroup.xlPrimary)
Set objSheet = ActiveWorkbook.Sheets("Sheet1")

Do While objSheet.Range("A" & i).Value < ""
If objSheet.Range("A" & i).Value = "06:00:00 AM" Then
TIT = Format(objSheet.Range("c" & i), "Long Date")
j = i + 29
rn = "R" & j & "C2:" & "R" & i & "C2"
k = k + 1
ActiveWorkbook.ActiveChart.SeriesCollection.NewSer ies
ActiveWorkbook.ActiveChart.SeriesCollection(k).Nam e = TIT
ActiveWorkbook.ActiveChart.SeriesCollection(k).Val ues =
"=Sheet1!" & rn 'Sheets("sheet1").Range(rn)
ActiveChart.SeriesCollection(1).XValues = "=Sheet1!R32C1:R61C1"

End If


i = i + 1
Loop
.Refresh


what i am doing is, two series for two dates. only changing values for same
category (x) axis
I do manually i am getting graph they way I want, when use above script,
first series is correct but
for second series, it is ploting graph by combing both date values.

can any one help me to solve

Thanks
K

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ask for the column of the datasheet building the present linechart Uli Charts and Charting in Excel 2 July 16th 09 04:54 PM
VBA, VB Script and VB clara Excel Programming 1 January 14th 08 03:10 PM
Need some VB script, please rlee1999 Excel Programming 2 October 25th 06 05:56 PM
VB Script Steph[_3_] Excel Programming 3 June 1st 05 04:49 PM
Excel 2000/XP script to Excel97 script hat Excel Programming 3 March 2nd 04 03:56 PM


All times are GMT +1. The time now is 10:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"