+ Reply to Thread
Results 1 to 3 of 3

Filter within data in Scatter Chart?

Hybrid View

  1. #1
    Registered User
    Join Date
    02-17-2022
    Location
    Spain
    MS-Off Ver
    365 MSO 64 bits
    Posts
    11

    Question Filter within data in Scatter Chart?

    Hello World!

    I'm trying to get this thing done but it's consuming my mind...
    The thing is:

    I have a VBA created Scatter Chart with all coordenates in table. The thing is that I would like to filter with diferent letters that appear in column "D"... How can I do that?

    I attach my code that generates the Scatter Chart XY (it takes all data without taking into account letter in column "D").
    Right now series follows group of 2 columns each, but I would like to be for each row... taking values by 2 each.

    Many Thanks you all!

    A.png

    Private Sub XY_Click()
    Dim xrng As Range
    Dim yrng As Range
    Dim Chart1 As Chart
    
    Set stCell = Range("F17")
    Set sht = ActiveSheet
    Set Chart1 = sht.Shapes.AddChart.Chart
    With Chart1
        .ChartType = xlXYScatter
            With Chart1
           .ChartArea.Height = 340.15
           .ChartArea.Width = 453.55
           .Parent.Left = Range("H1").Left
           .Parent.Top = Range("H1").Top
            
              ' Apply Chart Template
        Chart1.HasLegend = False
     
      ' Name the x-Axis:
        Chart1.Axes(xlCategory).HasTitle = True
        Chart1.Axes(xlCategory).AxisTitle.Text = "X"
    
      ' Name the y-Axis:
        Chart1.Axes(xlValue).HasTitle = True
        Chart1.Axes(xlValue).AxisTitle.Text = "Y"
    
    
        For Each sr In .SeriesCollection
            sr.Delete
        Next sr
        For n = 1 To (sht.Cells(stCell.Row, sht.Columns.Count).End(xlToLeft).Column - stCell.Column + 1) / 2
            lr1 = sht.Cells(sht.Rows.Count, (n - 1) * 2 + stCell.Column).End(xlUp).Row
            Set xrng = sht.Cells(stCell.Row + 1, (n - 1) * 2 + stCell.Column).Resize(lr1 - stCell.Row)
            Set yrng = sht.Cells(stCell.Row + 1, (n - 1) * 2 + stCell.Column + 1).Resize(lr1 - stCell.Row)
            .SeriesCollection.NewSeries
            .SeriesCollection(n).XValues = xrng
            .SeriesCollection(n).Values = yrng
        .SeriesCollection(n).MarkerStyle = xlCircle
        .SeriesCollection(n).MarkerSize = 15
        .SeriesCollection(n).MarkerForegroundColor = 255
        'SeriesCollection(n).Format.Fill.ForeColor.RGB = 0
        .SeriesCollection(n).Fill.Visible = msoFalse
        
        Next n
        
      End With
    End With
    
    End Sub
    Last edited by Ralar; 05-19-2022 at 08:08 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,480

    Re: Filter within data in Scatter Chart?

    If you have the setting for not displaying hidden rows you could just filter the data
    That assumes that none of the xy data points on a row are required.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    02-17-2022
    Location
    Spain
    MS-Off Ver
    365 MSO 64 bits
    Posts
    11

    Re: Filter within data in Scatter Chart?

    Wow! That's true! I didn't thought about that...

    Many Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Set Source Data for Scatter Chart
    By ryanpetersen in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-04-2014, 07:40 PM
  2. [SOLVED] Exclude one data series from scatter chart legend (but not from the chart)
    By JayUSA in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 05-29-2012, 05:24 PM
  3. Plot 3 sets of data in scatter chart and area chart in one
    By geoffs52 in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 12-24-2009, 04:42 AM
  4. Scatter plots with non-contiguous data after auto-filter
    By ardnegan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-24-2007, 12:54 PM
  5. Scatter Chart data
    By rfronk in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 06-18-2005, 09:05 AM
  6. Scatter Chart data
    By rfronk in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 06-16-2005, 08:05 PM
  7. Data Points in Scatter Chart
    By CWILSON in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 01-26-2005, 10:07 PM

Tags for this Thread

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