LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default problem with VBA to draw vertical lines

I have an X-Y scatter plot as an embedded chart. I have a list of X & Y
values that I would like to use to draw vertical lines on the chart. The
range for x-series is AB10:AC33, and I would like to use the same values to
define the y-values (AD10:AE10). I started by recording a macro for adding
one series to the chart, then tried to generalize using a for...next loop for
adding all 24. This of course did not work. Here is my code:
Private Sub combobox_2_click()

Dim i As Integer
Dim num As Integer
Dim myRange As Range

If Range("focus_choice") = "All" Then

Application.ScreenUpdating = False
Worksheets(2).Activate
Set myRange = Range("chr_start")
num = ActiveSheet.ChartObjects(1).Chart.SeriesCollection .count


For i = 1 To 24
With ActiveSheet
..ChartObjects(1).Chart.SeriesCollection.NewSeries
..ChartObjects(1).Chart.SeriesCollection(1).Series (num +
1).XValues = myRange.Offset(i, 0)
..ChartObjects(1).Chart.SeriesCollection(1).Series (num +
1).Values = Worksheets(2).Range(Cells(30, 10), Cells(31, 10))
End With

With
ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1).Series(num + 1).Border
..ColorIndex = vbWhite
..LineStyle = xlContinuous
End With

With
ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1).Series(num + 1)
..MarkerStyle = xlNone
End With

Next i

End If

Application.ScreenUpdating = True

End Sub


This does not work because I get an error message that says the "object
doesn't support this method or property" for the second assignment after the
for i = 1 to 24 (.ChartObjects(1).Chart.SeriesCollection(1).Series (num +
1).XValues = myRange.Offset(i, 0)). I know this can be done, but I need
help, so ... please help.

Thanks in advance,

Warren
 
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
draw vertical line to mark today in diagram Florian Demmer Excel Discussion (Misc queries) 1 January 22nd 08 01:31 PM
VBA to draw lines of SPC Daniel Charts and Charting in Excel 4 July 31st 07 08:44 PM
Vertical Lines on the Lines on 2 Axes Chart [email protected] Charts and Charting in Excel 3 March 3rd 06 04:14 AM
Draw lines in a userform gbottesi Excel Programming 3 July 8th 04 05:20 PM
How do I draw lines..?? MIKEB Excel Programming 4 October 24th 03 12:22 AM


All times are GMT +1. The time now is 01:29 AM.

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

About Us

"It's about Microsoft Excel"