Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: Chart Problem

  1. #1


    I created a chart in my workbook, it has
    noly one series. Then I made a simple sub
    procedure to change the data
    in the series by feeding an array to
    SeriesCollection(1).Values. And I got run-
    time error 1004, depending on the array size
    and the data format. For example, using
    array size 10 and data like 1.11111111,
    everything is fine; but if I use array size
    100 and data like 1.11, I got run-time error.
    The following is the sub procedure. I am
    using EXCEL 2000 in Windows 2000.

    Sub test()
    Dim cht As Chart
    Dim Xdata() As String
    Dim data() As Double

    Dim average As Double
    Dim i As Integer
    Dim k As Integer
    Dim r As Range

    k = 100
    average = 1.11

    ReDim data(0 To k) As Double
    ReDim Xdata(0 To k) As String

    Set cht = ThisWorkbook.Charts("Chart1")

    For i = 0 To k
    Xdata(i) = "Point" & CStr(i + 1)
    data(i) = average

    Next i

    With cht
    '.SeriesCollection(1).XValues = Xdata
    .SeriesCollection(1).Values = data

    End With

    End Sub

  2. #2
    Board Regular
    Join Date
    Feb 2002
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)


    Re boot and see if it clears!

    BTW leave off for 2 mins just in case Windows if grumpy.... See if that helps

    Free Excel based Web Toolbar available here.

    Jack in the UK
    J & R Excel Solutions
    "making Excel work for you"

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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