Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 24th, 2005, 04:44 AM
Registered User
 
Join Date: Jun 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Getting chart range help

Im in need of getting the range of a current excel chart, iv only managed to set the range vi


Dim chart As Excel.Chart
Dim sheet As Excel.Worksheet

sheet = ExcelApp.Sheets(HiddenSheet)
chart.SetSourceData(sheet.Range("A1:A10"))

but i need to keep the current range as well as add a new series to the current chart... im stumped with this one.. any one else got a clue?

 
Old June 24th, 2005, 05:37 AM
Registered User
 
Join Date: Jun 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Got a little bit further.. but looks like this wont work..

Dim ser As Excel.Series
For Each ser In chart.SeriesCollection
                Debug.WriteLine("series formula: " + ser.Formula.ToString)
Next

the actual formula for the chart is as follows
 '='Prime-history'!$C$11:$D$498
the out put from the lines of code above are
 'series formula: =SERIES('Prime-history'!$D$11,'Prime-history'!$C$12:$C$498,'Prime-history'!$D$12:$D$498,1)

Kewl so i thought it would just mean a little but of string handeling to get the result i want. But the a did the same thing graphing a chart with data from two different places in the same sheet..

Now
the actual formula for the chart is as follows
 '='m3'!$D$6:$E$39,'m3'!$J$18,'m3'!$J$18,'m3'!$K$18 :$K$45
the out put from the lines of code above are
 'series formula: =SERIES('m3'!$E$6,'m3'!$D$7:$D$39,'m3'!$E$7:$E$39, 1)
 'series formula: =SERIES('m3'!$K$18,'m3'!$D$7:$D$39,'m3'!$K$19:$K$4 5,2)

now thats just two case's there are probaly about 50 different ways of selecting data for a series.. so i think im back at square one..






Similar Threads
Thread Thread Starter Forum Replies Last Post
Range selection keithd Excel VBA 7 April 7th, 2005 11:29 AM
Using Customized chart for Pivot Chart kliu9 Excel VBA 3 October 13th, 2004 09:37 AM
Excel VBA: Select range of data and plot chart? xitu Excel VBA 1 December 23rd, 2003 04:21 AM
Drill Down from Bar Chart to another chart snowbird Crystal Reports 0 July 11th, 2003 01:53 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.