A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Charts and Charting
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How to format a line between two points?



 
 
Thread Tools Display Modes
  #1  
Old March 31st, 2009, 03:17 AM posted to microsoft.public.excel.charting
Mark Stephens
external usenet poster
 
Posts: 8
Default How to format a line between two points?

Hi,

Used to be as easy as recording a macro and seeing how to do it, god knows
why microsoft chose to drop this useful feature... c'est la vie.

I have a line chart and wish to apply a different colour to a portion of the
line according to some vba parameters i have defined.

It would be ideal to be able to do ti without activation the chart, I found
some code posted by John Peltier in December:

With Worksheets("sheet 2?).ChartObjects("chart1?).Chart.SeriesCollection( 1)

but this doesn't seem to work giving the error:

Compile error:

Expected: list seperator or )


and highlighting the quote mark after sheet 2 to the bracket after chart1

I have tried messing about with it but can't get it to work.

Anyway, that one aside, I want to say:

For bPointNo = 2303 To 2666

ActiveSheet.ChartObjects("Cht_Comparison").Activat e
ActiveChart.SeriesCollection(1).Points(2303).Selec t
ActiveChart.SeriesCollection(1).Colour = Red

Next bPointNo

The last line is obviously not going to work so I have put it just to show
what I am trying to achieve.

This should be so straightforward, I am pretty disappointed in Microsoft,
why I wonder have they chosen to make excel so un user friendly to vba
users?

Thanks and regards, Mark




  #2  
Old March 31st, 2009, 10:38 AM posted to microsoft.public.excel.charting
Andy Pope
external usenet poster
 
Posts: 2,088
Default How to format a line between two points?

Hi,

Try this, change the loop values to suit.

With ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1)
.Format.Line.Visible = msoCTrue
.Format.Line.ForeColor.RGB = vbBlue
For bPointNo = 5 To 10
With .Points(bPointNo).Format.Line
.ForeColor.RGB = vbRed
End With
Next
End With

Cheers
Andy
--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Mark Stephens" wrote in message
...
Hi,

Used to be as easy as recording a macro and seeing how to do it, god knows
why microsoft chose to drop this useful feature... c'est la vie.

I have a line chart and wish to apply a different colour to a portion of
the line according to some vba parameters i have defined.

It would be ideal to be able to do ti without activation the chart, I
found some code posted by John Peltier in December:

With Worksheets("sheet
2?).ChartObjects("chart1?).Chart.SeriesCollection( 1)

but this doesn't seem to work giving the error:

Compile error:

Expected: list seperator or )


and highlighting the quote mark after sheet 2 to the bracket after chart1

I have tried messing about with it but can't get it to work.

Anyway, that one aside, I want to say:

For bPointNo = 2303 To 2666

ActiveSheet.ChartObjects("Cht_Comparison").Activat e
ActiveChart.SeriesCollection(1).Points(2303).Selec t
ActiveChart.SeriesCollection(1).Colour = Red

Next bPointNo

The last line is obviously not going to work so I have put it just to show
what I am trying to achieve.

This should be so straightforward, I am pretty disappointed in Microsoft,
why I wonder have they chosen to make excel so un user friendly to vba
users?

Thanks and regards, Mark





  #3  
Old April 18th, 2009, 12:19 PM posted to microsoft.public.excel.charting
Andy Pope
external usenet poster
 
Posts: 2,088
Default How to format a line between two points?

Hi,

This sort of thing?

Dim objSeries As Series

Set objSeries = ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1)
objSeries.Format.Line.ForeColor.ObjectThemeColor = msoThemeColorAccent3

Cheers
Andy

mark Stephens wrote:
Thanks Andy, works like a dream... do you know how to formata line using
ther excel 2007 built in presets via vba as the macro won't capture them?

Thanks and regards, mark

"Andy Pope" wrote in message
...

Hi,

Try this, change the loop values to suit.

With ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1)
.Format.Line.Visible = msoCTrue
.Format.Line.ForeColor.RGB = vbBlue
For bPointNo = 5 To 10
With .Points(bPointNo).Format.Line
.ForeColor.RGB = vbRed
End With
Next
End With

Cheers
Andy
--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Mark Stephens" wrote in message
...

Hi,

Used to be as easy as recording a macro and seeing how to do it, god
knows why microsoft chose to drop this useful feature... c'est la vie.

I have a line chart and wish to apply a different colour to a portion of
the line according to some vba parameters i have defined.

It would be ideal to be able to do ti without activation the chart, I
found some code posted by John Peltier in December:

With Worksheets("sheet
2?).ChartObjects("chart1?).Chart.SeriesCollecti on(1)

but this doesn't seem to work giving the error:

Compile error:

Expected: list seperator or )


and highlighting the quote mark after sheet 2 to the bracket after chart1

I have tried messing about with it but can't get it to work.

Anyway, that one aside, I want to say:

For bPointNo = 2303 To 2666

ActiveSheet.ChartObjects("Cht_Comparison").Activat e
ActiveChart.SeriesCollection(1).Points(2303).Selec t
ActiveChart.SeriesCollection(1).Colour = Red

Next bPointNo

The last line is obviously not going to work so I have put it just to
show what I am trying to achieve.

This should be so straightforward, I am pretty disappointed in Microsoft,
why I wonder have they chosen to make excel so un user friendly to vba
users?

Thanks and regards, Mark








--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
  #4  
Old April 18th, 2009, 02:27 PM posted to microsoft.public.excel.charting
Andy Pope
external usenet poster
 
Posts: 2,088
Default How to format a line between two points?

The msoThemeColorAccent3 type information should appear via intellisense.
If not use the Object browser, F2.
Or the help.

Name Value Description
msoNotThemeColor 0 Specifies no theme color.
msoThemeColorAccent1 5 Specifies the Accent 1 theme color.
msoThemeColorAccent2 6 Specifies the Accent 2 theme color.
msoThemeColorAccent3 7 Specifies the Accent 3 theme color.
msoThemeColorAccent4 8 Specifies the Accent 4 theme color.
msoThemeColorAccent5 9 Specifies the Accent 5 theme color.
msoThemeColorAccent6 10 Specifies the Accent 6 theme color.
msoThemeColorBackground1 14 Specifies the Background 1 theme color.
msoThemeColorBackground2 16 Specifies the Background 2 theme color.
msoThemeColorDark1 1 Specifies the Dark 1 theme color.
msoThemeColorDark2 3 Specifies the Dark 2 theme color.
msoThemeColorFollowedHyperlink 12 Specifies the theme color for a
clicked hyperlink.
msoThemeColorHyperlink 11 Specifies the theme color for a hyperlink.
msoThemeColorLight1 2 Specifies the Light 1 theme color.
msoThemeColorLight2 4 Specifies the Light 2 theme color.
msoThemeColorMixed -2 Specifies a mixed color theme.
msoThemeColorText1 13 Specifies the Text 1 theme color.
msoThemeColorText2 15 Specifies the Text 2 theme color.


Cheers
Andy


mark Stephens wrote:
Hi Andy,

Yes that's it thanks...is there a list of the various presets somewhere do
yoyu know to save me having to find the one I want by trial and error?

Thank as always for your help, kind regards, Mark


"Andy Pope" wrote in message
...

Hi,

This sort of thing?

Dim objSeries As Series

Set objSeries = ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1)
objSeries.Format.Line.ForeColor.ObjectThemeColor =
msoThemeColorAccent3

Cheers
Andy

mark Stephens wrote:

Thanks Andy, works like a dream... do you know how to formata line using
ther excel 2007 built in presets via vba as the macro won't capture them?

Thanks and regards, mark

"Andy Pope" wrote in message
. ..


Hi,

Try this, change the loop values to suit.

With ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1)
.Format.Line.Visible = msoCTrue
.Format.Line.ForeColor.RGB = vbBlue
For bPointNo = 5 To 10
With .Points(bPointNo).Format.Line
.ForeColor.RGB = vbRed
End With
Next
End With

Cheers
Andy
--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Mark Stephens" wrote in message
. ..


Hi,

Used to be as easy as recording a macro and seeing how to do it, god
knows why microsoft chose to drop this useful feature... c'est la vie.

I have a line chart and wish to apply a different colour to a portion of
the line according to some vba parameters i have defined.

It would be ideal to be able to do ti without activation the chart, I
found some code posted by John Peltier in December:

With Worksheets("sheet
2?).ChartObjects("chart1?).Chart.SeriesCollec tion(1)

but this doesn't seem to work giving the error:

Compile error:

Expected: list seperator or )


and highlighting the quote mark after sheet 2 to the bracket after
chart1

I have tried messing about with it but can't get it to work.

Anyway, that one aside, I want to say:

For bPointNo = 2303 To 2666

ActiveSheet.ChartObjects("Cht_Comparison").Activat e
ActiveChart.SeriesCollection(1).Points(2303).Selec t
ActiveChart.SeriesCollection(1).Colour = Red

Next bPointNo

The last line is obviously not going to work so I have put it just to
show what I am trying to achieve.

This should be so straightforward, I am pretty disappointed in
Microsoft, why I wonder have they chosen to make excel so un user
friendly to vba users?

Thanks and regards, Mark






--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info





--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
  #5  
Old April 19th, 2009, 03:01 AM posted to microsoft.public.excel.charting
Mark Stephens
external usenet poster
 
Posts: 8
Default How to format a line between two points?

Thanks Andy, works like a dream... do you know how to formata line using
ther excel 2007 built in presets via vba as the macro won't capture them?

Thanks and regards, mark

"Andy Pope" wrote in message
...
Hi,

Try this, change the loop values to suit.

With ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1)
.Format.Line.Visible = msoCTrue
.Format.Line.ForeColor.RGB = vbBlue
For bPointNo = 5 To 10
With .Points(bPointNo).Format.Line
.ForeColor.RGB = vbRed
End With
Next
End With

Cheers
Andy
--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Mark Stephens" wrote in message
...
Hi,

Used to be as easy as recording a macro and seeing how to do it, god
knows why microsoft chose to drop this useful feature... c'est la vie.

I have a line chart and wish to apply a different colour to a portion of
the line according to some vba parameters i have defined.

It would be ideal to be able to do ti without activation the chart, I
found some code posted by John Peltier in December:

With Worksheets("sheet
2?).ChartObjects("chart1?).Chart.SeriesCollection( 1)

but this doesn't seem to work giving the error:

Compile error:

Expected: list seperator or )


and highlighting the quote mark after sheet 2 to the bracket after chart1

I have tried messing about with it but can't get it to work.

Anyway, that one aside, I want to say:

For bPointNo = 2303 To 2666

ActiveSheet.ChartObjects("Cht_Comparison").Activat e
ActiveChart.SeriesCollection(1).Points(2303).Selec t
ActiveChart.SeriesCollection(1).Colour = Red

Next bPointNo

The last line is obviously not going to work so I have put it just to
show what I am trying to achieve.

This should be so straightforward, I am pretty disappointed in Microsoft,
why I wonder have they chosen to make excel so un user friendly to vba
users?

Thanks and regards, Mark







  #6  
Old April 19th, 2009, 03:53 AM posted to microsoft.public.excel.charting
Mark Stephens
external usenet poster
 
Posts: 8
Default How to format a line between two points?

Hi Andy,

Yes that's it thanks...is there a list of the various presets somewhere do
yoyu know to save me having to find the one I want by trial and error?

Thank as always for your help, kind regards, Mark


"Andy Pope" wrote in message
...
Hi,

This sort of thing?

Dim objSeries As Series

Set objSeries = ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1)
objSeries.Format.Line.ForeColor.ObjectThemeColor =
msoThemeColorAccent3

Cheers
Andy

mark Stephens wrote:
Thanks Andy, works like a dream... do you know how to formata line using
ther excel 2007 built in presets via vba as the macro won't capture them?

Thanks and regards, mark

"Andy Pope" wrote in message
...

Hi,

Try this, change the loop values to suit.

With ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1)
.Format.Line.Visible = msoCTrue
.Format.Line.ForeColor.RGB = vbBlue
For bPointNo = 5 To 10
With .Points(bPointNo).Format.Line
.ForeColor.RGB = vbRed
End With
Next
End With

Cheers
Andy
--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Mark Stephens" wrote in message
.. .

Hi,

Used to be as easy as recording a macro and seeing how to do it, god
knows why microsoft chose to drop this useful feature... c'est la vie.

I have a line chart and wish to apply a different colour to a portion of
the line according to some vba parameters i have defined.

It would be ideal to be able to do ti without activation the chart, I
found some code posted by John Peltier in December:

With Worksheets("sheet
2?).ChartObjects("chart1?).Chart.SeriesCollect ion(1)

but this doesn't seem to work giving the error:

Compile error:

Expected: list seperator or )


and highlighting the quote mark after sheet 2 to the bracket after
chart1

I have tried messing about with it but can't get it to work.

Anyway, that one aside, I want to say:

For bPointNo = 2303 To 2666

ActiveSheet.ChartObjects("Cht_Comparison").Activat e
ActiveChart.SeriesCollection(1).Points(2303).Selec t
ActiveChart.SeriesCollection(1).Colour = Red

Next bPointNo

The last line is obviously not going to work so I have put it just to
show what I am trying to achieve.

This should be so straightforward, I am pretty disappointed in
Microsoft, why I wonder have they chosen to make excel so un user
friendly to vba users?

Thanks and regards, Mark








--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info



  #7  
Old April 20th, 2009, 01:25 AM posted to microsoft.public.excel.charting
Mark Stephens
external usenet poster
 
Posts: 8
Default How to format a line between two points?

Thaks a lot for that Andy, appreciate the help, regards, mark

"Andy Pope" wrote in message
...
The msoThemeColorAccent3 type information should appear via intellisense.
If not use the Object browser, F2.
Or the help.

Name Value Description
msoNotThemeColor 0 Specifies no theme color.
msoThemeColorAccent1 5 Specifies the Accent 1 theme color.
msoThemeColorAccent2 6 Specifies the Accent 2 theme color.
msoThemeColorAccent3 7 Specifies the Accent 3 theme color.
msoThemeColorAccent4 8 Specifies the Accent 4 theme color.
msoThemeColorAccent5 9 Specifies the Accent 5 theme color.
msoThemeColorAccent6 10 Specifies the Accent 6 theme color.
msoThemeColorBackground1 14 Specifies the Background 1 theme color.
msoThemeColorBackground2 16 Specifies the Background 2 theme color.
msoThemeColorDark1 1 Specifies the Dark 1 theme color.
msoThemeColorDark2 3 Specifies the Dark 2 theme color.
msoThemeColorFollowedHyperlink 12 Specifies the theme color for a clicked
hyperlink.
msoThemeColorHyperlink 11 Specifies the theme color for a hyperlink.
msoThemeColorLight1 2 Specifies the Light 1 theme color.
msoThemeColorLight2 4 Specifies the Light 2 theme color.
msoThemeColorMixed -2 Specifies a mixed color theme.
msoThemeColorText1 13 Specifies the Text 1 theme color.
msoThemeColorText2 15 Specifies the Text 2 theme color.


Cheers
Andy


mark Stephens wrote:
Hi Andy,

Yes that's it thanks...is there a list of the various presets somewhere
do yoyu know to save me having to find the one I want by trial and error?

Thank as always for your help, kind regards, Mark


"Andy Pope" wrote in message
...

Hi,

This sort of thing?

Dim objSeries As Series

Set objSeries = ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1)
objSeries.Format.Line.ForeColor.ObjectThemeColor =
msoThemeColorAccent3

Cheers
Andy

mark Stephens wrote:

Thanks Andy, works like a dream... do you know how to formata line using
ther excel 2007 built in presets via vba as the macro won't capture
them?

Thanks and regards, mark

"Andy Pope" wrote in message
.. .


Hi,

Try this, change the loop values to suit.

With ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1)
.Format.Line.Visible = msoCTrue
.Format.Line.ForeColor.RGB = vbBlue
For bPointNo = 5 To 10
With .Points(bPointNo).Format.Line
.ForeColor.RGB = vbRed
End With
Next
End With

Cheers
Andy
--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Mark Stephens" wrote in message
.. .


Hi,

Used to be as easy as recording a macro and seeing how to do it, god
knows why microsoft chose to drop this useful feature... c'est la vie.

I have a line chart and wish to apply a different colour to a portion
of the line according to some vba parameters i have defined.

It would be ideal to be able to do ti without activation the chart, I
found some code posted by John Peltier in December:

With Worksheets("sheet
2?).ChartObjects("chart1?).Chart.SeriesColle ction(1)

but this doesn't seem to work giving the error:

Compile error:

Expected: list seperator or )


and highlighting the quote mark after sheet 2 to the bracket after
chart1

I have tried messing about with it but can't get it to work.

Anyway, that one aside, I want to say:

For bPointNo = 2303 To 2666

ActiveSheet.ChartObjects("Cht_Comparison").Activat e
ActiveChart.SeriesCollection(1).Points(2303).Selec t
ActiveChart.SeriesCollection(1).Colour = Red

Next bPointNo

The last line is obviously not going to work so I have put it just to
show what I am trying to achieve.

This should be so straightforward, I am pretty disappointed in
Microsoft, why I wonder have they chosen to make excel so un user
friendly to vba users?

Thanks and regards, Mark






--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info





--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:32 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.