I'm new to VBA so I hope someone can help me with a Range question.
- I'm using Excel 2003
- Every week I add several days/rows of data
- I have a Chart that I want to update when I add new data
- I would like to pass the number of data points to be charted to the Sub
- I created a user defined function that returns the last row that contains data
LastRowData = CountRows(1)
- Here is how is might go:
Sub UpdateChart(DataPoints)
Sheets("Charts").Select
ActiveSheet.ChartObjects("Chart 2").Active
ActiveChart.ChartArea.Select
LastRowData = CountRows(1)
'Xvalues are in ColB; Values are in ColC
??This is where I do not know how to define ranges??
ActiveChart.SeriesCollection(1).XValues = "='Letter Data L'!??:??"
ActiveChart.SeriesCollection(1).Values = "='Letter Data L'!??:??"
End Sub
Any Help is appreciated - Many Thanks!
- I'm using Excel 2003
- Every week I add several days/rows of data
- I have a Chart that I want to update when I add new data
- I would like to pass the number of data points to be charted to the Sub
- I created a user defined function that returns the last row that contains data
LastRowData = CountRows(1)
- Here is how is might go:
Sub UpdateChart(DataPoints)
Sheets("Charts").Select
ActiveSheet.ChartObjects("Chart 2").Active
ActiveChart.ChartArea.Select
LastRowData = CountRows(1)
'Xvalues are in ColB; Values are in ColC
??This is where I do not know how to define ranges??
ActiveChart.SeriesCollection(1).XValues = "='Letter Data L'!??:??"
ActiveChart.SeriesCollection(1).Values = "='Letter Data L'!??:??"
End Sub
Any Help is appreciated - Many Thanks!