View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Papou Papou is offline
external usenet poster
 
Posts: 56
Default Error '1004' (Method 'Cells' of '_Global' Failed) On chart creation?

Hi Nook
Try
SetSourceData newBook.Worksheets("Output Data").Range(Cells(1,7),
Cells(SampleSize + 1, 8)).Address

HTH
Cordially
Pascal

"NooK " a écrit dans le message de
...
I have been having a problem when trying to create a chart on Excel.

Basically the code is like this:

With ActiveChart
SetSourceData newBook.Worksheets("Output Data").Range(Cells(1,
7), Cells(SampleSize + 1, 8))
HasTitle = True
ChartType = xlXYScatter
ChartTitle.Characters.Text = "Linearized Weibull chart"
Axes(xlCategory, xlPrimary).HasTitle = True
Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "x1"
Axes(xlValue, xlPrimary).HasTitle = True
Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "y1"
End With

The problem occurs on .SetSourceData line.

newBook is public and set to the workbook currently active and
SampleSize is 196 at the time (And declared locally) and at line 197
there is data so I don't see what is causing it.

Has anybody got this error before? It's been driving me mad.


Best Regards

NooK


---
Message posted from http://www.ExcelForum.com/