Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 181
Default XL2002 - Help with Points in SeriesCollection

Hi All

I'm trying to align a rectangle (called mySpacer) with the Left edge of
Point(x) in a SeriesCollection. The following line of code returns error 438
so I'm presuming
the 'Points' object doesn't have a Left value.

ActiveChart.Shapes("mySpacer").Left =
ActiveChart.SeriesCollection(1).Point(x).Left

Can you steer me in the right direction?
(I've looked at Jon Peltier's site but can't see anything obvoius.)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default XL2002 - Help with Points in SeriesCollection

Hi,

You will need to calculate the position using other information in the chart
that does return a Left/Top/Width/Height property.

Can you provide a little more information such as chart type, how should the
shape be positioned vertically.
And which xl version are you using?

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Trevor Williams" wrote in
message ...
Hi All

I'm trying to align a rectangle (called mySpacer) with the Left edge of
Point(x) in a SeriesCollection. The following line of code returns error
438
so I'm presuming
the 'Points' object doesn't have a Left value.

ActiveChart.Shapes("mySpacer").Left =
ActiveChart.SeriesCollection(1).Point(x).Left

Can you steer me in the right direction?
(I've looked at Jon Peltier's site but can't see anything obvoius.)


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 181
Default XL2002 - Help with Points in SeriesCollection

Hi Andy - thanks for the quick response.

I'm using XL2002. The chart is a ColumnChart.
I need to add a predefined image above each point in the series collection.
The images are named "pic1, pic2..." etc.

I resize 'mySpacer' by dividing the the Category Axis width by the count of
the points in the chart. 'mySpacer' is aligned to the Value Axis Top -20.

I want to align mySpacer to the left of each point and then align the image
centrally to mySpacer.

Here's my code to align the images...

Sub mcr_Add_Comms_Potential_Dots_To_Graphs()
Dim cell As Range

x = 1

For Each cell In Range("D38:D67")
If cell = "" Then Exit For
ActiveSheet.Shapes("pic" & x).Cut
ActiveSheet.ChartObjects("Chart 1").Activate
With ActiveChart
.Paste
With .Shapes.Range(Array("pic" & x, "mySpacer"))
.Align msoAlignBottoms, False
.Align msoAlignRights, False
.Align msoAlignCenters, False
.Align msoAlignMiddles, False
End With

ActiveChart.Shapes("mySpacer").Left =
ActiveChart.SeriesCollection(1).Point(x + 1).Left

End With
x = x + 1
Next

End Sub



"Andy Pope" wrote:

Hi,

You will need to calculate the position using other information in the chart
that does return a Left/Top/Width/Height property.

Can you provide a little more information such as chart type, how should the
shape be positioned vertically.
And which xl version are you using?

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Trevor Williams" wrote in
message ...
Hi All

I'm trying to align a rectangle (called mySpacer) with the Left edge of
Point(x) in a SeriesCollection. The following line of code returns error
438
so I'm presuming
the 'Points' object doesn't have a Left value.

ActiveChart.Shapes("mySpacer").Left =
ActiveChart.SeriesCollection(1).Point(x).Left

Can you steer me in the right direction?
(I've looked at Jon Peltier's site but can't see anything obvoius.)



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default XL2002 - Help with Points in SeriesCollection

Can I make an alternative suggestion first.
Use some dummy data series to position and holder the images within the
chart.
Try this, on a blank worksheet enter the following data

B1: =Data C1: =Space D1: =Image Holder
A2: =a B2: =1 C2: =MAX($B2:$B5)-B2+1 D2: =1
A3: =b B3: =2 C3: =MAX($B2:$B5)-B2+1 D3: =1
A4: =c B4: =3 C4: =MAX($B2:$B5)-B2+1 D4: =1
A5: =d B5: =4 C5: =MAX($B2:$B5)-B2+1 D5: =1

Create a stacked column on the range A1:D5
Format the Space series to have no fill or border pattern.

Now add 4 pictures to the worksheet.
Use the following code to place a copy of each picture above a column.

'-------------------------------------------
Sub x()

Dim chtTemp As Chart
Dim shpPics(4) As Shape
Dim lngIndex As Long

Set chtTemp = ActiveSheet.ChartObjects(1).Chart
For lngIndex = 1 To 4
Set shpPics(lngIndex) = ActiveSheet.Shapes(lngIndex + 1)
Next

With chtTemp
.Parent.Activate
With .SeriesCollection(3)
For lngIndex = 1 To .Points.Count
.Points(lngIndex).Select
shpPics(lngIndex).Copy
Selection.Paste
Next
End With
End With

End Sub
'------------------------

Is this a workable approach for you?

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Trevor Williams" wrote in
message ...
Hi Andy - thanks for the quick response.

I'm using XL2002. The chart is a ColumnChart.
I need to add a predefined image above each point in the series
collection.
The images are named "pic1, pic2..." etc.

I resize 'mySpacer' by dividing the the Category Axis width by the count
of
the points in the chart. 'mySpacer' is aligned to the Value Axis Top -20.

I want to align mySpacer to the left of each point and then align the
image
centrally to mySpacer.

Here's my code to align the images...

Sub mcr_Add_Comms_Potential_Dots_To_Graphs()
Dim cell As Range

x = 1

For Each cell In Range("D38:D67")
If cell = "" Then Exit For
ActiveSheet.Shapes("pic" & x).Cut
ActiveSheet.ChartObjects("Chart 1").Activate
With ActiveChart
.Paste
With .Shapes.Range(Array("pic" & x, "mySpacer"))
.Align msoAlignBottoms, False
.Align msoAlignRights, False
.Align msoAlignCenters, False
.Align msoAlignMiddles, False
End With

ActiveChart.Shapes("mySpacer").Left =
ActiveChart.SeriesCollection(1).Point(x + 1).Left

End With
x = x + 1
Next

End Sub



"Andy Pope" wrote:

Hi,

You will need to calculate the position using other information in the
chart
that does return a Left/Top/Width/Height property.

Can you provide a little more information such as chart type, how should
the
shape be positioned vertically.
And which xl version are you using?

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Trevor Williams" wrote in
message ...
Hi All

I'm trying to align a rectangle (called mySpacer) with the Left edge of
Point(x) in a SeriesCollection. The following line of code returns
error
438
so I'm presuming
the 'Points' object doesn't have a Left value.

ActiveChart.Shapes("mySpacer").Left =
ActiveChart.SeriesCollection(1).Point(x).Left

Can you steer me in the right direction?
(I've looked at Jon Peltier's site but can't see anything obvoius.)




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 181
Default XL2002 - Help with Points in SeriesCollection

Hi Andy - I think I've cracked it using the Yaxis.left plus pointwidth *
point number...

Dim cell As Range
x = 1
a = 0

ActiveSheet.ChartObjects("Chart 1").Activate
myPointwidth = ActiveChart.Axes(xlCategory, xlPrimary).Width /
ActiveChart.SeriesCollection(1).Points.Count

For Each cell In Range("D38:D67")

If cell = "" Then Exit For
ActiveChart.Shapes("mySpacer").Left = ActiveChart.Axes(xlValue,
xlPrimary).Left + (myPointwidth * a)
ActiveSheet.Shapes("pic" & x).Cut
With ActiveChart
.Paste
With .Shapes.Range(Array("pic" & x, "mySpacer"))
.Align msoAlignBottoms, False
.Align msoAlignRights, False
.Align msoAlignCenters, False
.Align msoAlignMiddles, False
End With

End With
x = x + 1
a = a + 1
Next

End Sub

"Andy Pope" wrote:

Hi,

You will need to calculate the position using other information in the chart
that does return a Left/Top/Width/Height property.

Can you provide a little more information such as chart type, how should the
shape be positioned vertically.
And which xl version are you using?

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Trevor Williams" wrote in
message ...
Hi All

I'm trying to align a rectangle (called mySpacer) with the Left edge of
Point(x) in a SeriesCollection. The following line of code returns error
438
so I'm presuming
the 'Points' object doesn't have a Left value.

ActiveChart.Shapes("mySpacer").Left =
ActiveChart.SeriesCollection(1).Point(x).Left

Can you steer me in the right direction?
(I've looked at Jon Peltier's site but can't see anything obvoius.)





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
How to Format numbers from percentage points to basis points Robaroo Excel Discussion (Misc queries) 2 April 3rd 23 06:58 PM
ActiveChart.SeriesCollection(1).Points(3).Select ERROR SpeeD72[_2_] Excel Programming 4 November 3rd 07 06:24 PM
XL2002 - SeriesCollection.Index Trevor Williams Excel Programming 3 October 29th 07 03:05 PM
xl2002: Position Picture in SeriesCollection Trevor Williams Excel Programming 10 October 23rd 07 04:02 PM
Obtaining the value of an ActiveChart.SeriesCollection(1).Points(2) Greg Glynn Excel Programming 7 May 11th 07 03:11 PM


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