PC Review


Reply
Thread Tools Rate Thread

Changing Input to code that creates a chart

 
 
Andreww
Guest
Posts: n/a
 
      17th Nov 2009
Hi - I have a report that has a chart in it. Every time the use
changes the dimensions / measures of the report grid, I want the chart
to reflect that change. At the moment I can't see how to even delete
my chart and then recereate it with different data range.

Sub make_chart()
Charts.Add
ActiveChart.ChartType = xlLine
ActiveChart.SetSourceData Source:=Sheets("Detail").Range("B7:H9"),
PlotBy:= _
xlRows
ActiveChart.Location Where:=xlLocationAsObject, Name:="Detail"
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
End Sub

Ideally I would like to get some code that means the chart is updated
and when the report grid changes, if that's a lot of grief then just
being able to delete existing chart and then define a new one would
do.

Any help appreciated.

Thanks

Andrew
 
Reply With Quote
 
 
 
 
chg
Guest
Posts: n/a
 
      17th Nov 2009
Have you looked into dynamic and interactive charts with name ranges
e.g. http://peltiertech.com/Excel/Charts/...umnChart1.html

 
Reply With Quote
 
Andreww
Guest
Posts: n/a
 
      17th Nov 2009
On 17 Nov, 13:13, chg <geier.ch...@gmail.com> wrote:
> Have you looked into dynamic and interactive charts with name ranges
> e.g.http://peltiertech.com/Excel/Charts/...umnChart1.html


Hi chg, thanks. I have pretty much got this sorted using dynamic
ranges.

I am just a bit surprised there isn't a way of doing this in VB.

Cheers

Andrew
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing chart data ranges from VBA code Andrew Microsoft Excel Programming 3 12th Dec 2007 01:26 PM
Pause code, wait for input, no input received, carry on with the code johnd@arm.co.uk Microsoft Excel Programming 1 29th Sep 2005 12:19 PM
Changing Chart Objects in Code Geoff Goodacre Microsoft Excel Worksheet Functions 1 4th Jun 2004 10:46 AM
Changing a chart source data in code. JimPNicholls Microsoft Excel Programming 1 7th May 2004 03:57 PM
Changing layout of Chart in Crystal Reports 9 dynamically from VB.NET code. Vadim Microsoft VB .NET 2 10th Mar 2004 05:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:54 PM.