View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
titi titi is offline
external usenet poster
 
Posts: 1
Default Referencing cells in a loop

Hi,
I am trying to generate automatically some graphs with a
macro, but I cannot find how to reference the cells.

What I want to do is to copy the graph, and then to change
the "source data". I have 20 graphs to do, so I need to
increment the row number.

Here is the macro for 1 graph:

Sub Macro2()
Sheets("Chart1").Select
Sheets("Chart1").Copy Befo=Sheets(2)
Sheets("Chart1 (2)").Select
Sheets("Chart1 (2)").Name = "Chart2"
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(1).Values = _
"=(Sheet1!R26C2,Sheet1!R7C3,Sheet1!R7C5,Sheet1 !
R7C7)"
ActiveChart.SeriesCollection(1).Name = "=""titi-2"""
End Sub


What I need to do is to vary R7 from R7 to R26. (and chart
2 form 2 to 22)

I already tried with "Rj" or cells(j,7), but nothing seems
to work!

Thanks for your help.