Hi,
I am trying to create a scatter plot but have run into some issues. I have 2 columns - 1 I want for the y axis, and 1 for the x axis. However, my code makes the chart so that the x axis is how many rows of data there are (0 to 6) and then plots 2 lines with data on the y axis. How do I fix this? Thanks
Here is my code:
Option Explicit
Private Sub Button2_Click()
ActiveSheet.Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=Worksheets("Charts").Range("B16:C20")
ActiveChart.ChartType = xlXYScatter
ActiveSheet.ChartObjects(1).Activate
End Sub
I am trying to create a scatter plot but have run into some issues. I have 2 columns - 1 I want for the y axis, and 1 for the x axis. However, my code makes the chart so that the x axis is how many rows of data there are (0 to 6) and then plots 2 lines with data on the y axis. How do I fix this? Thanks
Here is my code:
Option Explicit
Private Sub Button2_Click()
ActiveSheet.Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=Worksheets("Charts").Range("B16:C20")
ActiveChart.ChartType = xlXYScatter
ActiveSheet.ChartObjects(1).Activate
End Sub