#1   Report Post  
Junior Member
 
Location: Singapore
Posts: 5
Send a message via ICQ to Aloysicus
Default Macro help

Hi,

I am trying to figure out how to write a macro for a graph to change a point if the number falls below 80. Eg, if point a, b, c, d are at 79, 90, 78 & 60, the graphs will change the color of point a, c & d to a different color.

This is a line graph with many points.

Thanks in advance.
Aloys
  #2   Report Post  
bj
 
Posts: n/a
Default

I am a strong believer in writing brute force macros to make them work and
then once they do, clean them up with option explicit and dim statements, etc.
Here is a quick Brute force macro where you need to enter the details of the
data set for the chart series of interest in the macro
Worksheet name
Start row
end row
column
It also assumes series 1 is the series of interest
for my quick macro I used "<2" as my criteria.
I left in a couple of steps I ended up not using because there is
information which could be used when the macro is made more formal.

Sub m()
shtn = "Sheet1"
Srow = 1
Erow = 3
col = 1
SRN = ActiveChart.SeriesCollection(1).Formula =
"=SERIES(,,Sheet1!R1C1:R3C1,1)"
np = ActiveChart.SeriesCollection(1).Points().Count
For p = 1 To Erow - Srow + 1
If Sheets(shtn).Cells(Srow + p - 1, col) < 2 Then
ActiveChart.SeriesCollection(1).Points(p).Select
With Selection
.MarkerBackgroundColorIndex = 3
.MarkerForegroundColorIndex = 3
.MarkerStyle = xlDiamond
.MarkerSize = 10
.Shadow = False
End With
End If
Next p
End Sub

It needs a lot of input manipulation to make it be user friendly




"Aloysicus" wrote:


Hi,

I am trying to figure out how to write a macro for a graph to change a
point if the number falls below 80. Eg, if point a, b, c, d are at 79,
90, 78 & 60, the graphs will change the color of point a, c & d to a
different color.

This is a line graph with many points.

Thanks in advance.
Aloys


--
Aloysicus

  #3   Report Post  
Jon Peltier
 
Posts: n/a
Default

Read about conditional charts, no VBA necessary:

http://peltiertech.com/Excel/Charts/...nalChart1.html

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

Aloysicus wrote:

Hi,

I am trying to figure out how to write a macro for a graph to change a
point if the number falls below 80. Eg, if point a, b, c, d are at 79,
90, 78 & 60, the graphs will change the color of point a, c & d to a
different color.

This is a line graph with many points.

Thanks in advance.
Aloys


  #4   Report Post  
bj
 
Posts: n/a
Default

I use the method described in your paper quite often. Before I found out
about the Na() option I always just put my false response outside the plot
range. and selected max and min values for the graph. From force of habit,
I still do it this way most of the time.

"Jon Peltier" wrote:

Read about conditional charts, no VBA necessary:

http://peltiertech.com/Excel/Charts/...nalChart1.html

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

Aloysicus wrote:

Hi,

I am trying to figure out how to write a macro for a graph to change a
point if the number falls below 80. Eg, if point a, b, c, d are at 79,
90, 78 & 60, the graphs will change the color of point a, c & d to a
different color.

This is a line graph with many points.

Thanks in advance.
Aloys



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
Issuing macro in workbook from separate workbook Nigel Excel Discussion (Misc queries) 1 May 16th 05 05:46 PM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM
Date macro Hiking Excel Discussion (Misc queries) 9 February 3rd 05 12:40 AM
Help with macro formula and variable Huge project Excel Worksheet Functions 0 December 28th 04 01:27 AM
Macro and If Statement SATB Excel Discussion (Misc queries) 2 December 3rd 04 04:46 PM


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