that is what I get when I execute the following line to generate a graph through VBA.
ActiveChart.SetSourceData Source:=Sheets("2001 Data".Range(Cells(1, 1), Cells(currRow, 1)), PlotBy:=xlColumns
where currRow is the variable which stores the last row number, because I'm entering some values into the sheet from a sql db.
but if I hard code the last row number as below then it works fine. Why is the above error popping up????
ActiveChart.SetSourceData Source:=Sheets("2001 Data".Range("A1:C31", PlotBy:=xlColumns
ActiveChart.SetSourceData Source:=Sheets("2001 Data".Range(Cells(1, 1), Cells(currRow, 1)), PlotBy:=xlColumns
where currRow is the variable which stores the last row number, because I'm entering some values into the sheet from a sql db.
but if I hard code the last row number as below then it works fine. Why is the above error popping up????
ActiveChart.SetSourceData Source:=Sheets("2001 Data".Range("A1:C31", PlotBy:=xlColumns