So I have an excel file which have 8000+ rows, and I have to plot a xlscatter graph based on the B2 to B8000 and C2 to C8000. but the values taken to plot the graph must use every 50th cell, I have found similar question How to Use Every nth Cell in a Chart in Excel Programmatically . but the code given do not plot graph, its just a blank graph. Is there any solution for this?
[...]
Dim xS As String
Dim yS As String
xS = "="
yS = "="
For i = 1 To 23000 step 50
If i > 1 Then
xS = xS & ","
yS = yS & ","
End If
xS = xS & "A!$A$" & CStr(i)
yS = yS & "A!$B$" & CStr(i)
Next
ActiveChart.FullSeriesCollection(1).XValues = xS
ActiveChart.FullSeriesCollection(1).Values = yS
[...]
the one that I tried
First of all is the data coming from Sheet called A? if not then your code needs changing from:
xS = xS & "A!$A$" & CStr(i)
yS = yS & "A!$B$" & CStr(i)
To:
xS = xS & "Sheet1!$A$" & CStr(i) 'Where Sheet1 is your Sheet name.
yS = yS & "Sheet1!$B$" & CStr(i)
Also I'm pretty sure you should remove the following lines:
xS = "="
yS = "="
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.