+ Reply to Thread
Results 1 to 7 of 7

Multiple large .NewSeries lead to Run-time error 1004

  1. #1
    Dave Booker
    Guest

    Multiple large .NewSeries lead to Run-time error 1004

    I have the following code block, operating on a chart object named currChart,
    which creates a set of series that reference cells from a worksheet object
    named simulationSheet:

    Dim newSeries As Series
    For i = 1 To numSeries
    'Create a new series
    Set newSeries = currChart.SeriesCollection.NewSeries
    newSeries.name = simulationSheet.Cells(1, i)
    newSeries.Values =
    simulationSheet.Range(simulationSheet.Cells(2, i),
    simulationSheet.Cells(numDays, i))
    Next i

    This code works great when numDays is small, less than 60. However, if I
    try to execute this code when numDays is large, say around 1600, then the
    first series I create works. But the second time (when i = 2) the series is
    created, and then on the next line (where it modifies the name) I get the
    following error:

    Run-time error ‘1004’: Unable to set the Name property of the Series class

    Also, if I inspect the newSeries object after it has been created, many of
    its member objects (i.e. AxisGroup, ErrorBars, Formula…) have the value:

    <Unable to get the (object type AxisGroup,ErrorBars,Formula, …) property of
    the Series class>


  2. #2
    Kevin Yu [MSFT]
    Guest

    RE: Multiple large .NewSeries lead to Run-time error 1004

    Hi,

    We have reviewed this issue and are currently researching on it. We will
    update you ASAP. Thanks for your patience!

    Kevin Yu
    =======
    "This posting is provided "AS IS" with no warranties, and confers no
    rights."


  3. #3
    Jon Peltier
    Guest

    Re: Multiple large .NewSeries lead to Run-time error 1004

    While Kevin's working on it, try i=256, then i=257. In your code, i is the column
    index, and each worksheet is limited to 256 columns.

    - Jon
    -------
    Jon Peltier, Microsoft Excel MVP
    Peltier Technical Services
    Tutorials and Custom Solutions
    http://PeltierTech.com/
    _______

    Dave Booker wrote:

    > I have the following code block, operating on a chart object named currChart,
    > which creates a set of series that reference cells from a worksheet object
    > named simulationSheet:
    >
    > Dim newSeries As Series
    > For i = 1 To numSeries
    > 'Create a new series
    > Set newSeries = currChart.SeriesCollection.NewSeries
    > newSeries.name = simulationSheet.Cells(1, i)
    > newSeries.Values =
    > simulationSheet.Range(simulationSheet.Cells(2, i),
    > simulationSheet.Cells(numDays, i))
    > Next i
    >
    > This code works great when numDays is small, less than 60. However, if I
    > try to execute this code when numDays is large, say around 1600, then the
    > first series I create works. But the second time (when i = 2) the series is
    > created, and then on the next line (where it modifies the name) I get the
    > following error:
    >
    > Run-time error ‘1004’: Unable to set the Name property of the Series class
    >
    > Also, if I inspect the newSeries object after it has been created, many of
    > its member objects (i.e. AxisGroup, ErrorBars, Formula…) have the value:
    >
    > <Unable to get the (object type AxisGroup,ErrorBars,Formula, …) property of
    > the Series class>
    >



  4. #4
    Dave Booker
    Guest

    Re: Multiple large .NewSeries lead to Run-time error 1004

    i is always limited to something much smaller than 256. It's the row index,
    "numDays", whose magnitude is associated with this problem.

    "Jon Peltier" wrote:

    > While Kevin's working on it, try i=256, then i=257. In your code, i is the column
    > index, and each worksheet is limited to 256 columns.
    >
    > - Jon
    > -------
    > Jon Peltier, Microsoft Excel MVP
    > Peltier Technical Services
    > Tutorials and Custom Solutions
    > http://PeltierTech.com/
    > _______
    >
    > Dave Booker wrote:
    >
    > > I have the following code block, operating on a chart object named currChart,
    > > which creates a set of series that reference cells from a worksheet object
    > > named simulationSheet:
    > >
    > > Dim newSeries As Series
    > > For i = 1 To numSeries
    > > 'Create a new series
    > > Set newSeries = currChart.SeriesCollection.NewSeries
    > > newSeries.name = simulationSheet.Cells(1, i)
    > > newSeries.Values =
    > > simulationSheet.Range(simulationSheet.Cells(2, i),
    > > simulationSheet.Cells(numDays, i))
    > > Next i
    > >
    > > This code works great when numDays is small, less than 60. However, if I
    > > try to execute this code when numDays is large, say around 1600, then the
    > > first series I create works. But the second time (when i = 2) the series is
    > > created, and then on the next line (where it modifies the name) I get the
    > > following error:
    > >
    > > Run-time error ‘1004’: Unable to set the Name property of the Series class
    > >
    > > Also, if I inspect the newSeries object after it has been created, many of
    > > its member objects (i.e. AxisGroup, ErrorBars, Formula…) have the value:
    > >
    > > <Unable to get the (object type AxisGroup,ErrorBars,Formula, …) property of
    > > the Series class>
    > >

    >
    >


  5. #5
    Jon Peltier
    Guest

    Re: Multiple large .NewSeries lead to Run-time error 1004

    Sorry, I missed that.

    Does the range specified in the code contain any plottable data? If not, several
    chart types (line and XY for example) will not be able to access the series formula,
    Xvalues, values, or name in VBA. Can you manually create the series with the
    proscribed data range?

    - Jon
    -------
    Jon Peltier, Microsoft Excel MVP
    Peltier Technical Services
    Tutorials and Custom Solutions
    http://PeltierTech.com/
    _______

    Dave Booker wrote:

    > i is always limited to something much smaller than 256. It's the row index,
    > "numDays", whose magnitude is associated with this problem.
    >
    > "Jon Peltier" wrote:
    >
    >
    >>While Kevin's working on it, try i=256, then i=257. In your code, i is the column
    >>index, and each worksheet is limited to 256 columns.
    >>
    >>- Jon
    >>-------
    >>Jon Peltier, Microsoft Excel MVP
    >>Peltier Technical Services
    >>Tutorials and Custom Solutions
    >>http://PeltierTech.com/
    >>_______
    >>
    >>Dave Booker wrote:
    >>
    >>
    >>>I have the following code block, operating on a chart object named currChart,
    >>>which creates a set of series that reference cells from a worksheet object
    >>>named simulationSheet:
    >>>
    >>> Dim newSeries As Series
    >>> For i = 1 To numSeries
    >>> 'Create a new series
    >>> Set newSeries = currChart.SeriesCollection.NewSeries
    >>> newSeries.name = simulationSheet.Cells(1, i)
    >>> newSeries.Values =
    >>>simulationSheet.Range(simulationSheet.Cells(2, i),
    >>>simulationSheet.Cells(numDays, i))
    >>> Next i
    >>>
    >>>This code works great when numDays is small, less than 60. However, if I
    >>>try to execute this code when numDays is large, say around 1600, then the
    >>>first series I create works. But the second time (when i = 2) the series is
    >>>created, and then on the next line (where it modifies the name) I get the
    >>>following error:
    >>>
    >>>Run-time error ‘1004’: Unable to set the Name property of the Series class
    >>>
    >>>Also, if I inspect the newSeries object after it has been created, many of
    >>>its member objects (i.e. AxisGroup, ErrorBars, Formula…) have the value:
    >>>
    >>><Unable to get the (object type AxisGroup,ErrorBars,Formula, …) property of
    >>>the Series class>
    >>>

    >>



  6. #6
    Dave Booker
    Guest

    Re: Multiple large .NewSeries lead to Run-time error 1004

    Yes, it's valid data, and it can be manually charted. Besides, it crashes
    before you even try to reference the data range.

    "Jon Peltier" wrote:

    > Sorry, I missed that.
    >
    > Does the range specified in the code contain any plottable data? If not, several
    > chart types (line and XY for example) will not be able to access the series formula,
    > Xvalues, values, or name in VBA. Can you manually create the series with the
    > proscribed data range?
    >
    > - Jon
    > -------
    > Jon Peltier, Microsoft Excel MVP
    > Peltier Technical Services
    > Tutorials and Custom Solutions
    > http://PeltierTech.com/
    > _______
    >
    > Dave Booker wrote:
    >
    > > i is always limited to something much smaller than 256. It's the row index,
    > > "numDays", whose magnitude is associated with this problem.
    > >
    > > "Jon Peltier" wrote:
    > >
    > >
    > >>While Kevin's working on it, try i=256, then i=257. In your code, i is the column
    > >>index, and each worksheet is limited to 256 columns.
    > >>
    > >>- Jon
    > >>-------
    > >>Jon Peltier, Microsoft Excel MVP
    > >>Peltier Technical Services
    > >>Tutorials and Custom Solutions
    > >>http://PeltierTech.com/
    > >>_______
    > >>
    > >>Dave Booker wrote:
    > >>
    > >>
    > >>>I have the following code block, operating on a chart object named currChart,
    > >>>which creates a set of series that reference cells from a worksheet object
    > >>>named simulationSheet:
    > >>>
    > >>> Dim newSeries As Series
    > >>> For i = 1 To numSeries
    > >>> 'Create a new series
    > >>> Set newSeries = currChart.SeriesCollection.NewSeries
    > >>> newSeries.name = simulationSheet.Cells(1, i)
    > >>> newSeries.Values =
    > >>>simulationSheet.Range(simulationSheet.Cells(2, i),
    > >>>simulationSheet.Cells(numDays, i))
    > >>> Next i
    > >>>
    > >>>This code works great when numDays is small, less than 60. However, if I
    > >>>try to execute this code when numDays is large, say around 1600, then the
    > >>>first series I create works. But the second time (when i = 2) the series is
    > >>>created, and then on the next line (where it modifies the name) I get the
    > >>>following error:
    > >>>
    > >>>Run-time error ‘1004’: Unable to set the Name property of the Series class
    > >>>
    > >>>Also, if I inspect the newSeries object after it has been created, many of
    > >>>its member objects (i.e. AxisGroup, ErrorBars, Formula…) have the value:
    > >>>
    > >>><Unable to get the (object type AxisGroup,ErrorBars,Formula, …) property of
    > >>>the Series class>
    > >>>
    > >>

    >
    >


  7. #7
    Jon Peltier
    Guest

    Re: Multiple large .NewSeries lead to Run-time error 1004

    This procedure ran for a number of values of numDays:

    Sub ChartMe()
    Dim newSeries As Series
    Dim i As Long
    Dim currChart As Chart
    Dim simulationSheet As Worksheet
    Dim numDays As Long
    Dim numSeries As Integer

    numSeries = 5
    numDays = 3200 ' 6, 60, 600
    Set currChart = ActiveChart
    Set simulationSheet = ActiveSheet

    For i = 1 To numSeries
    'Create a new series
    Set newSeries = currChart.SeriesCollection.newSeries
    newSeries.Name = simulationSheet.Cells(1, i)
    newSeries.Values = _
    simulationSheet.Range(simulationSheet.Cells(2, i), _
    simulationSheet.Cells(numDays, i))
    Next i

    End Sub

    - Jon
    -------
    Jon Peltier, Microsoft Excel MVP
    Peltier Technical Services
    Tutorials and Custom Solutions
    http://PeltierTech.com/
    _______

    Dave Booker wrote:

    > Yes, it's valid data, and it can be manually charted. Besides, it crashes
    > before you even try to reference the data range.
    >
    > "Jon Peltier" wrote:
    >
    >
    >>Sorry, I missed that.
    >>
    >>Does the range specified in the code contain any plottable data? If not, several
    >>chart types (line and XY for example) will not be able to access the series formula,
    >>Xvalues, values, or name in VBA. Can you manually create the series with the
    >>proscribed data range?
    >>
    >>- Jon
    >>-------
    >>Jon Peltier, Microsoft Excel MVP
    >>Peltier Technical Services
    >>Tutorials and Custom Solutions
    >>http://PeltierTech.com/
    >>_______
    >>
    >>Dave Booker wrote:
    >>
    >>
    >>>i is always limited to something much smaller than 256. It's the row index,
    >>>"numDays", whose magnitude is associated with this problem.
    >>>
    >>>"Jon Peltier" wrote:
    >>>
    >>>
    >>>
    >>>>While Kevin's working on it, try i=256, then i=257. In your code, i is the column
    >>>>index, and each worksheet is limited to 256 columns.
    >>>>
    >>>>- Jon
    >>>>-------
    >>>>Jon Peltier, Microsoft Excel MVP
    >>>>Peltier Technical Services
    >>>>Tutorials and Custom Solutions
    >>>>http://PeltierTech.com/
    >>>>_______
    >>>>
    >>>>Dave Booker wrote:
    >>>>
    >>>>
    >>>>
    >>>>>I have the following code block, operating on a chart object named currChart,
    >>>>>which creates a set of series that reference cells from a worksheet object
    >>>>>named simulationSheet:
    >>>>>
    >>>>> Dim newSeries As Series
    >>>>> For i = 1 To numSeries
    >>>>> 'Create a new series
    >>>>> Set newSeries = currChart.SeriesCollection.NewSeries
    >>>>> newSeries.name = simulationSheet.Cells(1, i)
    >>>>> newSeries.Values =
    >>>>>simulationSheet.Range(simulationSheet.Cells(2, i),
    >>>>>simulationSheet.Cells(numDays, i))
    >>>>> Next i
    >>>>>
    >>>>>This code works great when numDays is small, less than 60. However, if I
    >>>>>try to execute this code when numDays is large, say around 1600, then the
    >>>>>first series I create works. But the second time (when i = 2) the series is
    >>>>>created, and then on the next line (where it modifies the name) I get the
    >>>>>following error:
    >>>>>
    >>>>>Run-time error ‘1004’: Unable to set the Name property of the Series class
    >>>>>
    >>>>>Also, if I inspect the newSeries object after it has been created, many of
    >>>>>its member objects (i.e. AxisGroup, ErrorBars, Formula…) have the value:
    >>>>>
    >>>>><Unable to get the (object type AxisGroup,ErrorBars,Formula, …) property of
    >>>>>the Series class>
    >>>>>

    >>



+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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