Range name for source data in charts


Posted by Saeed on January 24, 2002 12:45 AM

My data source range for a chart changes everyday by one cell as new data arrives daily.

I want to change the source range of the chart via a macro. Anybody has any suggestions?

Thnx

Saeed



Posted by Keiser on January 24, 2002 2:13 AM

This could work if your list has no gaps. What it does is select the range of your list from a given point to the last cell containing data and then names that range. Hope this helps, it did for me.

Sub MySource()

'mark a starting point
Range("x starting point").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select

'Name given to the selected range
Names.Add Name:="X name", RefersTo:=Selection
end sub