![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
Board Regular
Join Date: Feb 2002
Posts: 3,065
|
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" |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|