Complete the code to select the chart type for a scatter plot in Excel.
ActiveSheet.Shapes.AddChart2(251, [1]).Select
The code uses xlXYScatter to create a scatter plot chart type in Excel VBA.
Complete the formula to calculate the slope of a scatter plot trendline in Excel.
=SLOPE(B2:B10, [1])The SLOPE function takes the known y-values first, then known x-values. Here, y-values are in B2:B10, so x-values must be A2:A10.
Fix the error in the VBA code to add a scatter plot with markers only (no lines).
With ActiveSheet.ChartObjects.Add(Left:=100, Top:=50, Width:=400, Height:=300).Chart .ChartType = [1] .SeriesCollection(1).Format.Line.Visible = msoFalse End With
True.To show markers only with no lines, use xlXYScatter as the chart type. Setting line visibility to False hides lines.
Fill both blanks to create a scatter plot with a linear trendline in VBA.
With ActiveSheet.ChartObjects.Add(Left:=50, Top:=50, Width:=300, Height:=200).Chart .ChartType = [1] .SeriesCollection(1).Trendlines.Add(Type:=[2]) End With
Use xlXYScatter for scatter plot and xlLinear for a linear trendline type.
Fill all three blanks to add a scatter plot, set marker style, and add a polynomial trendline of order 2.
With ActiveSheet.ChartObjects.Add(Left:=20, Top:=20, Width:=350, Height:=250).Chart .ChartType = [1] .SeriesCollection(1).MarkerStyle = [2] .SeriesCollection(1).Trendlines.Add(Type:=[3], Order:=2) End With
Use xlXYScatter for scatter plot, xlMarkerStyleCircle for circle markers, and xlPolynomial for polynomial trendline.