tags:

views:

22

answers:

1

Excel 2007 is driving me nuts. I have several charts set up that I refresh periodically against some data in a SQL database. However, every time I refresh them, Excel bumps any absolute ranges I have for the charts to view this data by the amount of new records returned from the query.

The data is time related (I have a record for each minute of the day), and I want the chart (line chart) to be fixed in size... instead, Excel wants it to dynamically change, and thus it adds the extra rows to my named ranges.

Is there a way to prevent Excel from updating absolute named ranges when new data from a data source is returned? I hope this makes sense.

A: 

How are you defining your named ranges? I'm assuming your are just using cell references, if so it may be worth looking at the offset function, particularly if you are dealing with fixed size ranges (e.g. minutes in a day).

For example, if you had column headers in the first row, your minutes were in column A and you had exactly 1 row for each minute your offset formula would look like:

OFFSET(A2,0,0,1,1440)

and is defined as

OFFSET(StartCell, OffsetRows, OffsetCols, Width, Height)

Because any of the values within the arguments can also be formulas, OFFSET is a very useful function in defining ranges.

Macros
Thanks for the reply... that does not seem to work. For example, if I have one sheet with the table data and another with the chart and I assign a named range to the sheet like so =OFFSET(DataSheet!$C$2,390,0) to capture 390 rows of data starting from C2, I don't get any data in the series... am I missing something?
Matt
Your offset function isn't correct, it needs 5 values - if your data starts at cell C2, and is 390 rows long you will probably need to use OFFSET(DataSheet!$C$2,0,0,1,390) which is saying 'start at cell C2, move 0 cells across and 0 cells down, and take a region 1 cell wide and 390 high'
Macros
Worked like a charm!!!! Thank you!
Matt