Hello,
Here is a good one I suspect.
I wasnt to graph a large quantity of data. I have made a macro that successfully plots a small subset of my data in an organized fashion. I always use a small subset of data to create my macros and then test on the full data set to confirm that there are no bugs. Usually I have no issues scaling up. But this time I cant understand why my chart object will not be created if my data size is too large. I am not trying to plot more than the 250 graphs at once --> just FYI.
To explain my problem will be too difficult so I have attached the small subset of test data and the full size data for comparison.
I hope someone can give me an answer as to why this is happening.
My macro code is below.
"test" file is the large file --> Macro will not create the chart object in this workbook.
"small book2" is the small file --> Macro will create the chart object in this workbook.
Thanks!!!
Sub Macro9()
'
Range("A1").Select
Set FindRng = ActiveSheet.UsedRange
With FindRng
Set c = ActiveSheet.UsedRange.Find(What:="AAAA", After:=FindRng.Cells(1, 1), LookIn:=xlValues, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
If Not c Is Nothing Then
First = c.Address
On Error Resume Next
Set rng = c
Do
Set rng = Union(rng, c)
Set c = ActiveSheet.UsedRange.FindNext(c)
Loop While Not c Is Nothing And c.Address <> First
End If
End With
rng.Select
LastCol3 = Selection.Count
With ActiveSheet
LastRow = Range("A1048576").End(xlUp).Row
Range("A5").Select
LastRow2 = Range(Selection, Selection.End(xlDown)).Count
Set Rngx = .Range("A6:A" & LastRow)
End With
Range("A1").Select
Cells.Find(What:="RunTime", After:=ActiveCell, LookIn:=xlValues, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Offset(1, 1).Select
'Do Until ActiveCell.Offset(-1, 0) = ""
If Not ActiveCell = "" Then
With ActiveSheet.ChartObjects.Add(Left:=100, Width:=550, Top:=75, Height:=325)
.Chart.ChartType = xlXYScatterSmoothNoMarkers
Set a = Selection
For x = 1 To LastCol3
Set Rngy = ActiveCell.Range("A1:A" & LastRow2 - 1)
.Chart.SeriesCollection.NewSeries
.Chart.SeriesCollection(x).XValues = Rngx
.Chart.SeriesCollection(x).Values = Rngy
.Chart.SeriesCollection(x).Name = ActiveCell.Offset(-5, 0)
.Chart.SeriesCollection(x).Format.Line.Weight = 1
.Chart.Axes(xlValue, xlPrimary).HasTitle = True
.Chart.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = ActiveCell.Offset(-1, 0)
.Chart.Axes(xlValue, xlPrimary).AxisTitle.Font.Size = 14
.Chart.Axes(xlValue, xlPrimary).AxisTitle.Font.Bold = True
.Chart.Axes(xlCategory, xlPrimary).HasTitle = True
.Chart.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Run Time (sec)"
.Chart.Axes(xlCategory, xlPrimary).AxisTitle.Font.Size = 14
.Chart.Axes(xlCategory, xlPrimary).AxisTitle.Font.Bold = True
.Chart.Legend.Font.Bold = True
.Chart.Legend.Font.Size = 12
.Chart.HasTitle = False
ActiveCell.Offset(0, 1).Select
Next x
End With
Else
ActiveCell.Offset(0, 1).Select
End If
'Loop
End Sub
Bookmarks