View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Cringing Dragon Cringing Dragon is offline
external usenet poster
 
Posts: 22
Default One line query on for loop assignment

How did you apply it? I didn't show the whole line, just the bit of it that I
was suggesting you change. The whole line needs to be:
ActiveChart.SeriesCollection(i).Values =
Sheets("Sheet1").Range(Cells(j,1),Cells(k,1))

In this post, that will wrap around onto 2 lines. You need to put it all on
one line.

If that's what you did already, or if you still get the error, can you
please post the block of lines around that one (ie the line before, that
line, and the line after)? Copy and paste them straight from your code, so I
can see exactly what you have.

" wrote:

On Oct 21, 12:49 am, Cringing Dragon
wrote:
Encase it in a Range, as follows:
Sheets("Sheet1").Range(Cells(j,1),Cells(k,1))



" wrote:
I have a line
ActiveChart.SeriesCollection(i).Name = Sheets("Sheet1").Cells(j, 2)
for assigning the legend name in a scatter chart which works
correctly.


I would like to assign .values from cells(j,1) to cells(k,1).. What is
the correct syntax to do it?
I get an error when I have a line like this.


ActiveChart.SeriesCollection(i).Values = Sheets("Sheet1").Cells(j,
1):cells(k,1)


Thanks- Hide quoted text -


- Show quoted text -


Thanks. But, I get an error like this

Method 'cells' of object '_Global' failed.

Please help me fix the error.