Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Wazooli
 
Posts: n/a
Default adding vertical bars to an embedded chart using VBA

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
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
Deactivating an embedded chart TheRobsterUK Excel Discussion (Misc queries) 0 October 3rd 05 01:30 AM
Activating a Chart object Hari Prasadh Charts and Charting in Excel 6 August 2nd 05 07:22 PM
Bars in a chart??????? Gee Excel Worksheet Functions 0 July 15th 05 11:36 AM
Urgent Chart Questions Brent E Excel Discussion (Misc queries) 0 May 9th 05 11:01 PM
Is there some way (event) to know when an embedded chart is deleted? [email protected] Charts and Charting in Excel 9 February 11th 05 03:26 PM


All times are GMT +1. The time now is 12:46 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"