Trying to graph > 32,000 points

Ironfist

New Member
Joined
Apr 13, 2011
Messages
4
All,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
I'm sure this question has been asked a lot. I searched and couldn't find anything specific to my problems. First things first, I suppose: 1. Windows Vista Enterprise with SP2, 2. MS Office Excel 2007.<o:p></o:p>
<o:p></o:p>
I have a worksheet that may contain anywhere from 1 to 1,000,000 rows and 3 columns of data which needs to be plotted. Because Excel only allows up to 32,000 data points per series, I am splitting the data up into 30,000 data point sections and plotting each section as its own series. When I have 32,000 data points (on the sheet since the series are fixed at 30,000) or less, everything works perfectly. When I have more points, I get a message which states; “The maximum number of data points you can use in a data series for a 2-D chart is 32,000. If you want to use more than 32,000 data points, you must create two or more series.” What is interesting to me is that the error occurs when I create the chart object on the worksheet, but haven't even added a series yet.<o:p></o:p>
<o:p></o:p>
Another item of interest is that, when I run the code the first time, no plot appears, however, if I run it again, the second plot appears. Then, when I delete the second plot, the first all of a sudden appears.<o:p></o:p>
<o:p></o:p>
Can anyone help me trying to figure out these oddities? Thank you for your efforts.

Matthew Lawrence<o:p></o:p>
<o:p></o:p>
Rich (BB code):
Sub Graph()
   Dim Range1
   Dim Range2
   Dim Range3
   Dim LastRow As Long
   Dim NumberOfRanges As Double
   Dim Chart As ChartObject
   Dim BegNumber As Long
   Dim i As Integer
 
   'Add chart onto active sheet
   Set Chart = ActiveSheet.ChartObjects.Add _
       (Left:=250, Width:=450, Top:=25, Height:=325)
 
   'Set chart parameters
   With Chart.Chart
       .ChartType = xlXYScatterLinesNoMarkers
       .Legend.Delete
   End With
 
   'Find the last row of data on the worksheet
   LastRow = Worksheets("Sheet1").Range("A1048576").End(xlUp).Row
 
   'find how many times to loop
   NumberOfRanges = Application.WorksheetFunction.Ceiling((LastRow - 1) / 30000, 1)
 
   'Start at row two
   BegNumber = 2
 
   'Loop until all all data is graphed
   For i = 0 To NumberOfRanges - 1
       Range1 = Range("G" & BegNumber & ":G" & BegNumber + 30000)
       Range2 = Range("F" & BegNumber & ":F" & BegNumber + 30000)
       Range3 = Range("K" & BegNumber & ":K" & BegNumber + 30000)
 
       With Chart.Chart.SeriesCollection.NewSeries
           .Values = Range2
           .XValues = Range1
           .Border.Color = RGB(255, 0, 0)
       End With
 
       With Chart.Chart.SeriesCollection.NewSeries
           .Values = Range3
           .XValues = Range1
           .Border.Color = RGB(0, 0, 255)
       End With
 
       BegNumber = BegNumber + 30001
 
   Next i
 
End Sub
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
A quick update:
The error occurs at the code below. At this point, the ChartObject shouldn’t have any idea how much data is going to get pushed into it, yet it still creates a message if I have over 32,000 data points on the worksheet.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
Rich (BB code):
   'Add chart onto active sheet
   Set Chart = ActiveSheet.ChartObjects.Add _
       (Left:=250, Width:=450, Top:=25, Height:=325)
<o:p></o:p>
Also, as a test, I removed the loop in the code and attempted to plot only one series of 30,000 points while still leaving greater than 32,000 points on the worksheet and I still got the message listed in the first post.
<o:p></o:p>
Can anyone help?
 
Upvote 0
If the activecell is within your data area excel will complain, even though the chartobject .add methough does not populate the chart.
 
Upvote 0
Andy,
A super simple answer and it worked perfectly! Thank you so much for your help; it is greatly appreciated!

Matt
 
Upvote 0

Forum statistics

Threads
1,224,526
Messages
6,179,322
Members
452,906
Latest member
Belthazar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top