Results 1 to 3 of 3

Using VBA macro to format points in scatter chart (by series)

Threaded View

DunnoExcel Using VBA macro to format... 01-24-2016, 09:42 PM
mikerickson Re: Using VBA macro to format... 01-24-2016, 10:37 PM
DunnoExcel Re: Using VBA macro to format... 01-24-2016, 11:49 PM
  1. #1
    Registered User
    Join Date
    01-22-2016
    Location
    Tokyo, Japan
    MS-Off Ver
    2013
    Posts
    5

    Using VBA macro to format points in scatter chart (by series)

    Hello,
    I would appreciate any help you can give.
    I have a scatter chart, excel 2013, where I have assigned code to give the
    points labels. I have 9 series. I would like to assign a specific marker style for
    each series (each point in series 1 is a blue circle, each point in series 2 is
    a blue triangle)...

    On Microsoft's website I found code such as:
    Charts("Chart1").SeriesCollection(1) _
    .MarkerStyle = xlMarkerStyleCircle

    but I do not know where to put it inside the code I am already using (I do not really know
    VBA and just copied/pasted this code.

    Could you tell me where to insert this code?

    *Also, if you could help me make the labels be in the center of the marker, that would be
    awesome.

    Thank you

    Sub CreateDataLabels()
    'variables for looping over chart objects
    Dim FilmChart As Chart
    Dim FilmDataSeries As Series
    'variables for looping over cells
    Dim SingleCell As Range
    Dim FilmList As Range
    'variable to keep track of number of films
    Dim FilmCounter As Integer
    FilmCounter = 1
    Set FilmList = Range("A10", "A210")
    Set FilmChart = ActiveSheet.ChartObjects(1).Chart
    'loop over each data series and enable data labels
    For Each FilmDataSeries In FilmChart.SeriesCollection
    FilmDataSeries.HasDataLabels = True
    Next FilmDataSeries
    'loop over each cell in the list of source data
    For Each SingleCell In FilmList
    'loop over each series in the chart
    For Each FilmDataSeries In FilmChart.SeriesCollection
    'change the label text to be the film's name
    FilmDataSeries.Points(FilmCounter).DataLabel.Text = SingleCell.Value
    Next FilmDataSeries
    FilmCounter = FilmCounter + 1
    Next SingleCell
    End Sub
    http://www.filedropper.com/exampleversionriskmapping example file without code
    Last edited by DunnoExcel; 01-25-2016 at 12:26 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 01-26-2016, 05:08 AM
  2. [SOLVED] overlapped points in X-Y scatter chart
    By mahmoodn in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 11-03-2013, 06:53 AM
  3. Excel Macro to Define Series Markers In Scatter Chart
    By andysweeney in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 11-19-2012, 05:10 AM
  4. Excel 2007 Changing the format of all series in an XYline scatter chart
    By fiona1234 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 08-07-2010, 06:50 AM
  5. Connect points in two different series on scatter graph
    By sa02000 in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 04-11-2009, 06:24 AM
  6. Macro to add labels to data points in an xy scatter chart
    By Scott Wagner in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 12-16-2005, 09:50 PM
  7. [SOLVED] Data Points in Scatter Chart
    By CWILSON in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 01-26-2005, 10:07 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1