Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VBA charting Question

the string xlDiamond is meaningless. xlDiamond is a constant defined to
mean

? xlDiamond
2

the number 2.

so you would need to pass the value 2 to MarkerSTyle

..MarkerStyle = 2

or MarkertypeArray(1) = xlDiamond
or MarkertypeArray(1) = 2

then
i = 1
..MarkerStyle = MarkertypeArray(i)

--
Regards,
Tom Ogilvy


Gromit wrote in message
...

Hi,

I'm trying to write some code to create a chart and format the series.
Things were all going well until I ran into the problem of adding a
different MarkerStyle to each series. I have a group of cells in a
worksheet (cells 12,15) to (cells 17,15) with the markertype names
listed (e.g. xlDiamond etc). I first put these into an array
MarkerTypeArray(i) using a For Next Loop which the watch window tells
me was successful.

However, when it comes to putting the names from the array into the
chart series, things don't work out, and I can't figure out why. I'm
using the code: (With series) .MarkerStyle = MarkerTypeArray(i)


When I hardwire .MarkerStyle = xlDiamond, it works. And I know that
MarkerTypeArray(i) contains the string 'xlDiamond'. So why doesn't
MarkerStyle = MarkerTypeArray(i) work?

Thanks in advance. The full code is below.

Graham


Sub AddChart()
Dim myChtObj As ChartObject
Dim MyNewSrs As Series
Dim MarkerTypeArray(12 To 17)
Dim i As Integer

For i = 12 To 17
MarkerTypeArray(i) = Workbooks("B19.xls").Sheets("Summary").Cells(i,
15)
Next i


Workbooks("B19.xls").Sheets("Summary").ChartObject s.Delete

Set myChtObj =
Workbooks("B19.xls").Sheets("Summary").ChartObject s.Add _
(Left:=100, Width:=500, Top:=75, Height:=400)
myChtObj.Chart.ChartType = xlLineMarkers
myChtObj.Chart.SetSourceData Source:=Sheets("Summary").Range("A1")

For i = 12 To 17
Set MyNewSrs = myChtObj.Chart.SeriesCollection.NewSeries
MsgBox MarkerTypeArray(i)
With MyNewSrs
Name = Cells(i, 13).Value
Values = Cells(i, 14).Value
XValues = Array(6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5)
MarkerStyle = MarkerTypeArray(i) '******** GIVES ERROR
Border.Weight = xlThin
Border.LineStyle = xlNone
MarkerBackgroundColorIndex = 2
MarkerForegroundColorIndex = 11
Smooth = False
MarkerSize = 5
Shadow = False
End With

Next i


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



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
Charting question Dabears70 Excel Discussion (Misc queries) 1 April 27th 07 07:44 AM
Charting Question BenWeber Charts and Charting in Excel 0 May 16th 06 11:24 PM
vba charting question [email protected] Charts and Charting in Excel 4 February 24th 06 11:54 PM
Charting Question sfrancoe Excel Discussion (Misc queries) 8 January 18th 06 10:32 PM


All times are GMT +1. The time now is 12:28 PM.

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"