ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Input data for graph (https://www.excelbanter.com/excel-programming/388859-input-data-graph.html)

Mathieu

Input data for graph
 
Hi, I am looking to update a chart at the end of a working routine. Each time
a new line is add and I only want the final four row. Here is what I have
done so far with everything I found out.

Sub MACRO1()

#line ok#Set chartrange = Range("D5").End(xlDown).Offset(-3, -3).Resize(4,
4).Activate

Here is where I got problems
Sheets("graph par qty").Select
ActiveChart.SetSourceData Source:=chartrange, PlotBy:=xlColumns

End Sub
--
Mathieu

Jon Peltier

Input data for graph
 
Change the first statement to

Set chartrange = Worksheets("Sheet
Name").Range("D5").End(xlDown).Offset(-3, -3).Resize(4, 4)

If this doesn't solve the problem, post back with a clearer description of
what didn't work.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Mathieu" wrote in message
...
Hi, I am looking to update a chart at the end of a working routine. Each
time
a new line is add and I only want the final four row. Here is what I have
done so far with everything I found out.

Sub MACRO1()

#line ok#Set chartrange = Range("D5").End(xlDown).Offset(-3, -3).Resize(4,
4).Activate

Here is where I got problems
Sheets("graph par qty").Select
ActiveChart.SetSourceData Source:=chartrange, PlotBy:=xlColumns

End Sub
--
Mathieu




Mathieu

Input data for graph
 
Thank you so much!!!, that is working. I am jsut beginning how to work with
vba and from what I discover, I should have learn that before. I will be
clearer next time!

Mathieu


"Jon Peltier" wrote:

Change the first statement to

Set chartrange = Worksheets("Sheet
Name").Range("D5").End(xlDown).Offset(-3, -3).Resize(4, 4)

If this doesn't solve the problem, post back with a clearer description of
what didn't work.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Mathieu" wrote in message
...
Hi, I am looking to update a chart at the end of a working routine. Each
time
a new line is add and I only want the final four row. Here is what I have
done so far with everything I found out.

Sub MACRO1()

#line ok#Set chartrange = Range("D5").End(xlDown).Offset(-3, -3).Resize(4,
4).Activate

Here is where I got problems
Sheets("graph par qty").Select
ActiveChart.SetSourceData Source:=chartrange, PlotBy:=xlColumns

End Sub
--
Mathieu






All times are GMT +1. The time now is 05:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com