Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 111
Default Switch chart points ON/OFF help request

To all,

I have the following macro that turns the points off on an embedded
chart. However I want to assign this to a check box, so when I check
it the points turn on, and when I un-check it the points turn off. I
believe that the macro will need to be modified to turn the points
back on again?


Sub pointson()

ActiveSheet.ChartObjects("Chart 5").Activate
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(2).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
End With
With Selection
.MarkerBackgroundColorIndex = xlAutomatic
.MarkerForegroundColorIndex = xlAutomatic
.MarkerStyle = xlNone
.Smooth = False
.MarkerSize = 5
.Shadow = False
End With
End Sub

Any ideas?

Thanks in advance for your help,

Regards

Joseph Crabtree
  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 6,582
Default Switch chart points ON/OFF help request

I made an embedded line chart with series AA and BB, both with default
formatting. I added two Forms menu checkboxes, which I renamed check_AA and
check_BB. I wrote a macro called ChangePoints, and assigned this macro to
both checkboxes. Here is the macro:

Sub ChangePoints()
Dim sSeriesName As String
Dim bSeriesShow As Boolean

sSeriesName = Mid(Application.Caller, InStr(Application.Caller, "_") + 1)
bSeriesShow = (ActiveSheet.CheckBoxes(Application.Caller).Value = 1)

With ActiveSheet.ChartObjects(1).Chart.SeriesCollection (sSeriesName)
If bSeriesShow Then
.Border.LineStyle = xlAutomatic
.MarkerStyle = xlAutomatic
Else
.Border.LineStyle = xlNone
.MarkerStyle = xlNone
End If
End With

End Sub

Notes:
Application.Caller is the name of the object that called the macro, in this
case check_AA or check_BB.
The CheckBox.Value is either 1 for true or -4146 for false.
If you have different (non-default) formatting, then you need more elaborate
code than BlahStyle = xlAutomatic.


- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"joecrabtree" wrote in message
...
To all,

I have the following macro that turns the points off on an embedded
chart. However I want to assign this to a check box, so when I check
it the points turn on, and when I un-check it the points turn off. I
believe that the macro will need to be modified to turn the points
back on again?


Sub pointson()

ActiveSheet.ChartObjects("Chart 5").Activate
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(2).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
End With
With Selection
.MarkerBackgroundColorIndex = xlAutomatic
.MarkerForegroundColorIndex = xlAutomatic
.MarkerStyle = xlNone
.Smooth = False
.MarkerSize = 5
.Shadow = False
End With
End Sub

Any ideas?

Thanks in advance for your help,

Regards

Joseph Crabtree



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
Excel 2003 Line Chart - Switch Axis Position sot Charts and Charting in Excel 2 September 27th 07 01:12 PM
How do I switch punctuation from commas to points? JoCarbo Excel Discussion (Misc queries) 1 July 11th 07 02:17 PM
HELP!!!!!!!!!! Y By X Chart with points. Curt Hand Charts and Charting in Excel 3 August 29th 06 03:15 PM
Bar Chart To Line Chart for last 3 points only Big H Charts and Charting in Excel 1 October 13th 05 09:55 PM
How do I switch the axis values in my chart Melissa Charts and Charting in Excel 3 February 9th 05 01:55 PM


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