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
Bookmarks