Populating a chart with Updating information
Try:
Sub newrange()
Dim x, y, r
For x = 1 To 200
If Cells(2, x) 0 Then y = x
Next
Range(Cells(1, y - 2), Cells(3, y)).Select
r = Selection.Address
ActiveSheet.ChartObjects("Diagram 2").Activate ' Set Diagram 2 to yur Shart
name
ActiveChart.ChartArea.Select
ActiveChart.SetSourceData Source:=Sheets("Ark1").Range(r), PlotBy:=xlRows '
Set Ark1 to yur Sheet name
Range("a1").Activate
End Sub
-----------------------------------------------------
"Lost and Looking for Help" skrev:
4/30/2006 5/7/2006 5/14/2006 5/21/2006 5/28/2006
202 129 87 0 0
153 320 54 0 0
I have a VBA Program that is pulling data from a continuously updating
spreadsheet. As you can see after the current week(5/14/2006) there is no
data and thus zeros returned. I need to copy and paste this information into
a preexisting chart. The chart is set up exactly like the information above.
I just need it to past the data from, 4/30, 5/7, 5/14 and then next week
when 5/21 is populated have the data shift and paste 5/7, 5/14, 5/21. So
basically take the date with the last information (no zeros) associated with
it and past that and the previous two weeks data into the chart.
I hope that made since.
Thanks,
Tim
|