LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default new excel vba functionality

I had prepared a response to your post but K Dales beat me to it. So I'll add
to his post. And a caution that I'm no expert - just someone like yourself.

A series contains a Points collection. Unfortunately, an individual point
does not support a Value property as shown he

Sub Test0()
Dim i As Long
With ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1)
.HasDataLabels = True
For i = 1 To .Points.Count
MsgBox .Points(i).DataLabel.Text
MsgBox .Points(i).MarkerStyle
'MsgBox .Points(i).Value 'This errors
Next
End With
End Sub

The Values property of a series returns an array of all the point values in
the series. However, there seems to be a bit of a glitch in extracting an
individual element as shown in the following three macros. But to answer your
question: Yes, it is already possible.

'This works
Sub Test1()
Dim i As Long
With ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1)
For i = 1 To .Points.Count
MsgBox Application.Index(.Values, i)
Next
End With
End Sub

'This also works
Sub Test2()
Dim arr As Variant
Dim i As Long
With ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1)
arr = .Values
For i = LBound(arr) To UBound(arr)
MsgBox arr(i)
Next
End With
End Sub

'This DOESN'T work
Sub Test3()
Dim i As Long
With ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1)
MsgBox IsArray(.Values)
MsgBox LBound(.Values)
MsgBox UBound(.Values)
For i = LBound(.Values) To UBound(.Values)
MsgBox .Values(i) 'Errors here ???
Next
End With
End Sub

Also note that since one usually knows the range address of the chart series
it is generally simple to extract it directly from the range rather than from
the series.

Regards,
Greg

"medicenpringles" wrote:


K Dales Wrote:
Many other properties of the points are available through
MySeries.Points,
of course.


so this is already possible?


--
medicenpringles


------------------------------------------------------------------------
medicenpringles's Profile: http://www.excelforum.com/member.php...o&userid=16458
View this thread: http://www.excelforum.com/showthread...hreadid=488827




 
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
Lost arrow functionality within Excel Mitch Excel Discussion (Misc queries) 1 March 5th 10 03:21 AM
form with excel and word functionality JOSHK Excel Discussion (Misc queries) 2 January 25th 07 08:06 PM
OS Version impact on Excel functionality Peter-d Excel Worksheet Functions 1 March 23rd 06 12:15 AM
Template functionality in Excel Abi Excel Discussion (Misc queries) 4 January 14th 05 12:23 AM
Easiest way to add functionality to ALL Excel spreadsheets Angus Comber[_2_] Excel Programming 5 December 18th 03 11:06 PM


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