Input data for graph

M

Mathieu

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
 
J

Jon Peltier

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
 
M

Mathieu

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top