Results 1 to 2 of 2

VBA Code to Format Individual Data Points Based Upon Adjacent Cell Values

This is a discussion on VBA Code to Format Individual Data Points Based Upon Adjacent Cell Values within the Excel Questions forums, part of the Question Forums category; Suppose I have a data set that looks like this: Position, Reading, Gage, Setting 1.3, 24, 1, A 1.6, 27, ...

  1. #1
    New Member
    Join Date
    Nov 2015
    Posts
    1

    Default VBA Code to Format Individual Data Points Based Upon Adjacent Cell Values

    Suppose I have a data set that looks like this:

    Position, Reading, Gage, Setting
    1.3, 24, 1, A
    1.6, 27, 2, A
    1.7, 22, 1, B
    1.8, 21, 2, B
    1.1, 25, 2, A

    Naturally, I'm working with a bigger data set, but key points are we have an independent variable "Position", a dependent variable "Reading", and two categorical variables "Gage" and "Setting".

    If I have a scatter plot in excel (X=>Position, Y=>Reading), how would I write a macro to set the color of the data point markers based upon the value in "Gage" column and the type of the data point markers based upon the value in the "Setting" column. I'm having trouble figuring out how to identify the location of the cell for a given point object. I've found similar code for changing whole series' format, but it relies on the formula for the series object. I'm not aware of the point object having a formula to "borrow from".

    Here's that example:

    FormulaSplit = Split(MySeries.Formula, ",")

    Set SourceRange = Range(FormulaSplit(2)).Item(1)

  2. #2
    Board Regular Rijnsent's Avatar
    Join Date
    Oct 2005
    Location
    Utrecht, Holland
    Posts
    846

    Default Re: VBA Code to Format Individual Data Points Based Upon Adjacent Cell Values

    Hi jgjengr,

    what you're looking for is basically something like this: Excel ScatterPlot with labels, colors and markers
    A non-VBA alternative: Conditional Formatting of Excel Charts - Peltier Tech Blog

    Hope that helps,

    Koen
    You can't post attachments here, but you can help me helping you by posting a screen shot directly in your post with any of those tools.
    And although it's against forum rules, otherwise use dropbox/google drive/etc to get your file accross.
    Finally, please show that you made an effort to solve your problem: Yes, I like to help, but am not going to do your job.

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


DMCA.com