Hi Experts,
I have an issue with my XY scatter. I have X and Y coordinates where X is from range C26 to C151 and Y is from H26 to H151. It does not bring right graph with below code. It works well if i do select range manually without code.
Here is the below code. Here I am taking values from Sheet4 and plotting graph in sheet 1.
Any help would be appreciated.
Regards,
Vik
Set sh = ActiveWorkbook.Worksheets("Sheet1")
Set chart1 = sh.Shapes.AddChart.Chart
'Set chart1 = Charts.Add
'Set CurSheet = Worksheets("Sheet4")
chart1.SetSourceData Source:=Worksheets("sheet4").Range("C26", "C151"), PlotBy:=xlColumns
chart1.SetSourceData Source:=Worksheets("sheet4").Range("H26", "H151"), PlotBy:=xlRows
chart1.ChartType = xlXYScatter
End Sub
Bookmarks