Hi,
I was wondering if you could help me with a piece of VBA that I wrote picking pieces from different websites (I have 0 exp. with VBA).
My data has two columns: Column A is stock price and Column B is option position, there are 360 rows of data in both columns.
Now I want to produce a Scatter chart with X axis having values (1,2,3....360) and Y axis has stock price (series 1) and option position (series 2). As you can see I want a delay between each plot after each x value and hence Im using VBA instead I would have directly done it using excel. Can you help please... below is what I has written so far... this works for columns but scatter plot does not work... Many thanks
+++++++++++++++++++++++++++++++
Sub Doublecharts()
Dim chart1 As ChartObject
Dim chart2 As ChartObject
Dim i As Integer
Dim j As Integer
Set chart1 = ActiveSheet.ChartObjects.Add(Left:=100, Top:=50, _
Width:=400, Height:=300)
Set chart2 = ActiveSheet.ChartObjects.Add(Left:=500, Top:=50, _
Width:=400, Height:=300)
chart1.Chart.ChartType = xlColumnClustered
chart2.Chart.ChartType = xlXYScatterSmoothNoMarkers
For j = 1 To 2
For i = 2 To 6
chart1.Chart.SetSourceData Source:=Sheets("sheet1").Range(Sheets("sheet1").Cells(2, 1), Sheets("sheet1").Cells(i, 2)), PlotBy:=xlColumns
chart2.Chart.SetSourceData Source:=Sheets("sheet1").Range(Sheets("sheet1").Cells(2, 1), Sheets("sheet1").Cells(i, j)), PlotBy:=xlColumns
Application.Wait (Now + (1 / (24 * 60 * 60#)))
Next i
Next j
End Sub
+++++++++++++++++++++++++++++++
I was wondering if you could help me with a piece of VBA that I wrote picking pieces from different websites (I have 0 exp. with VBA).
My data has two columns: Column A is stock price and Column B is option position, there are 360 rows of data in both columns.
Now I want to produce a Scatter chart with X axis having values (1,2,3....360) and Y axis has stock price (series 1) and option position (series 2). As you can see I want a delay between each plot after each x value and hence Im using VBA instead I would have directly done it using excel. Can you help please... below is what I has written so far... this works for columns but scatter plot does not work... Many thanks
+++++++++++++++++++++++++++++++
Sub Doublecharts()
Dim chart1 As ChartObject
Dim chart2 As ChartObject
Dim i As Integer
Dim j As Integer
Set chart1 = ActiveSheet.ChartObjects.Add(Left:=100, Top:=50, _
Width:=400, Height:=300)
Set chart2 = ActiveSheet.ChartObjects.Add(Left:=500, Top:=50, _
Width:=400, Height:=300)
chart1.Chart.ChartType = xlColumnClustered
chart2.Chart.ChartType = xlXYScatterSmoothNoMarkers
For j = 1 To 2
For i = 2 To 6
chart1.Chart.SetSourceData Source:=Sheets("sheet1").Range(Sheets("sheet1").Cells(2, 1), Sheets("sheet1").Cells(i, 2)), PlotBy:=xlColumns
chart2.Chart.SetSourceData Source:=Sheets("sheet1").Range(Sheets("sheet1").Cells(2, 1), Sheets("sheet1").Cells(i, j)), PlotBy:=xlColumns
Application.Wait (Now + (1 / (24 * 60 * 60#)))
Next i
Next j
End Sub
+++++++++++++++++++++++++++++++