Results 1 to 5 of 5

ChartObject will not add to the activesheet when data set is too large...

Threaded View

  1. #1
    Registered User
    Join Date
    04-25-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    91

    ChartObject will not add to the activesheet when data set is too large...

    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
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Display ChartObject from a datavalidation list
    By bktong in forum Excel General
    Replies: 1
    Last Post: 02-05-2011, 06:34 AM
  2. Passing chartobject as a parameter to sub
    By David Cohen in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-21-2005, 04:05 PM
  3. [SOLVED] Manipulating chartobject while workbook is shared.
    By Shelby Haynes in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-29-2005, 07:05 PM
  4. how to set a variable to a Chart? not ChartObject
    By Rich in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-06-2005, 03:05 PM
  5. ChartObject Name Restricion or Excel Bug
    By Gaston in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-14-2005, 02:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1