PDA

View Full Version : Auto Adjust Range on a graph? Help



benson8708
12-08-2011, 06:57 PM
I have a Graph that can have different amounts of data points. I have to Manually drag the blue box over the new data inorder for it to be displayed in the graph. If I remove a couple of rows of data the bars in my chart are not centered until I readjust the range. How can I have it automatically adjust the range? Can i use VBA to acomplish or is there a simplier way?

jolivanes
12-08-2011, 08:23 PM
If the data is in a sheet called "Hello" (without quotation marks) in column A starting at A3:
In the Name Manager, under "Names in Workbook:", enter a relative name (MonthlyIncome as an example).
In the "Refers to:" box, type in:


=OFFSET(Hello!$A$3,0,0,COUNTA(Hello!$A:$A),1)

In Source Data for your Chart in Series, use the name (MontlyIncome) for your X Values (or Y Values).
Do that for all your relative Columns (Different names and column references of course)
HTH
John

Jan Karel Pieterse
12-08-2011, 10:22 PM
A simpler approach is to select your data first and convert it to a list/Table (naming depends on Excel version) by hitting control+L. Then create the chart based on the new list/table.

jolivanes
12-08-2011, 10:52 PM
I'll have to try that Jan Karel.
Never too old to learn I guess.
Prettige Kerstdagen (Merry Christmas)

John