I change the code slightly so it should be easier to adapt for future use.

Sub Macro3()
'
' Macro3 Macro
'
    Dim rngXData As Range
    Dim rngYData As Range
'
    Set rngXData = Range("A2", Cells(Rows.Count, 1).End(xlUp))
    Set rngYData = rngXData.Offset(0, 1)
    
    With ActiveSheet.Shapes.AddChart.Chart
        Do While .SeriesCollection.Count > 0
            ' remove any series added automatically
            .SeriesCollection(1).Delete
        Loop
        With .SeriesCollection.NewSeries
            .Values = rngYData
            .XValues = rngXData
            .Name = "='" & ActiveSheet.Name & "'!" & rngYData.Offset(-1, 0).Cells(1, 1).Address
        End With
        .ChartType = xlXYScatterSmoothNoMarkers
    End With
    
End Sub