View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Alok Alok is offline
external usenet poster
 
Posts: 318
Default using variables in the range of source data

Hi

The problem may be because you are not qualifying 'Cells' with the name of
the worksheet.

Alok

"gvm" wrote:


I have the following line in working code:
ActiveChart.SetSourceData Source:=Sheets("Traffic model").Range("M14:M32"),
PlotBy:=xlColumns

and I want to change the argument of .Range() to use variables instead. So I
wrote:
ActiveChart.SetSourceData Source:=Sheets("Traffic
model").Range(Cells(initial_blank_count - 1, initial_column + 7), Cells(Rows,
initial_column + 7)), PlotBy:=xlColumns

The error a runtime error to effect of an application- or object-defined
error. The variables were used earlier in the sub without problems.

How do I straighten this out please? TIA ... Greg