Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Member Login

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Eng-Tips
*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...your web site's great! I've been using this system for almost a year now and find it really, really helpful. The people have been helpful in answering just about any question you post in the forums..."

Geography

Where in the world do Eng-Tips members come from?
vtmike (Mechanical)
9 Dec 10 14:47
Hi,

I am just starting to use macros in microsoft excel 2007. Does anyone have tips on how I can change the marker color in a XY scatter plot?

4    20    P
5    21    F
6    22    P
7    23    P
8    24    F
9    26    F

For example if the cell in column 3 above has "P", use a green marker & if the cell in column 3 has "F", use a red marker in the plot?
MintJulep (Mechanical)
9 Dec 10 14:49
As far as I know all the markers for any given series of data must be the same.

If you want different markers for different points you need to chart them as different series.
IRstuff (Aerospace)
9 Dec 10 15:05
Actually, it can be done.  There is a "Format Data Point" function, and the macro recorder captured this:

CODE

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 12/9/2010 by Eden Mei
'

'
    ActiveChart.SeriesCollection(1).Select
    ActiveChart.SeriesCollection(1).Points(8).Select
    With Selection.Border
        .Weight = xlThin
        .LineStyle = xlAutomatic
    End With
    With Selection
        .MarkerBackgroundColorIndex = xlNone
        .MarkerForegroundColorIndex = 41
        .MarkerStyle = xlSquare
        .MarkerSize = 3
        .Shadow = False
    End With
End Sub

so, the above selected the 8th point and only changed that one point's color to a shade of blue

TTFN

FAQ731-376: Eng-Tips.com Forum Policies
Chinese prisoner wins Nobel Peace Prize

vtmike (Mechanical)
9 Dec 10 16:38
Well but how do I incorporate an If statement for marker color? Take following code for example for returning the text "PASS", "FAIL" or "NA" based on entries in column 3:

Sub Example4()
    For x = 2 To 7
       If Cells(x, 3).Value = "P" Then
       Cells(x, 4) = "PASS"
       Else
       If Cells(x, 3).Value = "F" Then
       Cells(x, 4) = "FAIL"
       Else
       If Cells(x, 3).Value = "" Then
       Cells(x, 4) = "NA"
       End If
       End If
       End If
       Next x
    End Sub

How do I apply this concept to a XY plot to change color of marker based on the text input in column 3?
IRstuff (Aerospace)
9 Dec 10 17:51
Well, wouldn't you try to call the macro with the point number and a color index?

TTFN

FAQ731-376: Eng-Tips.com Forum Policies
Chinese prisoner wins Nobel Peace Prize

zelgar (Civil/Environmental)
13 Dec 10 12:05
Couldn't you just use Conditional Formatting in the cells to highlight them?

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close