View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Hutchins Tom Hutchins is offline
external usenet poster
 
Posts: 1,069
Default FOR loop macro clarification

Excel can't substitute values for j & K because they are 'hidden' inside
strings. Try

ActiveChart.SeriesCollection(i).Values = "='Sheet1'!R(" & j & ")C1:R(" & k &
")C1"
ActiveChart.SeriesCollection(i).Name = "='Sheet1'!R(" & j & ")C2"

Hope this helps,

Hutch

" wrote:

I get an error when I execute the for loop. Please help me fix the
error.

For i = 0 to 15
j = (i * 524)+46
k = j + 523


ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(i).XValues = "='Sheet1'!
R46C3:R569C3"

ActiveChart.SeriesCollection(i).Values = "='Sheet1'!R(j)C1:R(k)C1"
' Error here
ActiveChart.SeriesCollection(i).Name = "='Sheet1'!
R(j)C2" 'Error here


Next

Thanks