Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Jon Peltier
 
Posts: n/a
Default

A simplistic approach would be something like this. In the Define Names dialog
(Insert - Names - Define, or CTRL+F3), define a name such as this:

Name: ColumnA
Refers To:
=OFFSET(Sheet1!$A$1,0,0,COUNT(Sheet1!$A:$A),1)

Then in step 2 of the chart wizard, on the Series tab, for Values enter the
sheet-qualified range name:

=Sheet1!ColumnA

This could be readily automated using VBA:

Sub ChartDynamicColumns()
Dim rCol As Range
Dim rColName As Range
Dim sCol As String

Application.ScreenUpdating = False

For Each rCol In ActiveSheet.Columns
sCol = rCol.Address(ColumnAbsolute:=False)
sCol = Left(sCol, (Len(sCol) - 1) / 2)

ActiveWorkbook.Names.Add _
Name:="'" & ActiveSheet.Name & "'!Column" & sCol, _
RefersTo:="=OFFSET('" & ActiveSheet.Name & "'!$" & sCol & _
"$1,0,0,MAX(1,COUNT('" & ActiveSheet.Name & "'!$" & _
sCol & ":$" & sCol & ")),1)"

Set rColName = ActiveSheet.Range("Column" & sCol)
If WorksheetFunction.Count(rColName) 0 Then
With ActiveSheet.ChartObjects.Add(rColName.Left, 50, 200, 150).Chart
If .SeriesCollection.Count = 0 Then
.SeriesCollection.NewSeries
Else
Do While .SeriesCollection.Count 1
.SeriesCollection(1).Delete
Loop
End If
With .SeriesCollection(1)
.Values = "='" & ActiveSheet.Name & "'!Column" & sCol
End With
.ChartType = xlArea
End With
End If
Next

Application.ScreenUpdating = True
End Sub

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

No Such Luck wrote:
"Jon Peltier" wrote in message
...

You could look into dynamic named ranges for your source data ranges. Here
are a few examples and a lot of links:

http://peltiertech.com/Excel/Charts/Dynamics.html



Thanks, Jon.

I've actually tried several of the dynamic range tutorials without luck.
They all seemed to be geared toward a graph with data values and labels, but
I haven't been able to taylor them to work with my scenario. Could you,
perhaps, provide a very, very simple dynamic range solution for just a
column of data that will change in length (i.e., no labels, no column
headers (and thus, offsets), etc.) Just a simple column like:

4
3
8
1
6
1
4

whose area graph would automatically expand if you added two elements:

4
3
8
1
6
1
4
8
1



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I graph text information in Excel garrison0013 Charts and Charting in Excel 5 April 3rd 23 03:41 PM
Problem drawing lines on charts Susan Lambert Charts and Charting in Excel 7 December 13th 04 08:29 AM
How can I auto update a graph? Bigxcr Charts and Charting in Excel 2 November 30th 04 07:40 PM
compare unique identifiers in multiple ranges bawilli_91125 Charts and Charting in Excel 1 November 30th 04 06:34 PM
Named dynamic ranges, copied worksheets and graph source data WP Charts and Charting in Excel 1 November 28th 04 05:19 PM


All times are GMT +1. The time now is 01:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"