Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default How do I retrieve Chart Source (range) and PlotBy

I have a chart created by the Chart Wizard. Here's the
Macro that was generated during its creation:

Charts.Add()
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData(Source:=Sheets
("Sheet1").Range("A7:D15"), PlotBy _
:=xlColumns)
ActiveChart.Location
(Whe=xlLocationAsNewSheet)
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "1st
Quarter"
.Axes(xlCategory, xlPrimary).HasTitle =
False
.Axes(xlValue, xlPrimary).HasTitle = False
End With

How do I verify the Source and PlotBy properties of the
ActiveChart after its creation?

This is what I have so far to check other properties:

Dim ThisChart As Excel.Chart
ThisChart = appExcel.Charts.Item("Chart1")
If ThisChart.ChartType =
Excel.XlChartType.xlColumnClustered Then
MsgBox("ColumnClustered is Good")
End If
If ThisChart.HasTitle And
ThisChart.ChartTitle.Text = "1st Quarter" Then
MsgBox("ChartTitle is Good")
End If

Thanks, in advance, for your help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default I figured it out (m)

This is what you must do:

Dim ThisSeriesCollection As
Excel.SeriesCollection
ThisSeriesCollection =
ThisChart.SeriesCollection
If ThisSeriesCollection.Count = 3 Then
If ThisSeriesCollection.Item(1).Name
= "Jan" _
And ThisSeriesCollection.Item
(1).Formula = "=SERIES(Sheet1!$B$7,Sheet1!
$A$8:$A$15,Sheet1!$B$8:$B$15,1)" _
And ThisSeriesCollection.Item(2).Name
= "Feb" _
And ThisSeriesCollection.Item
(2).Formula = "=SERIES(Sheet1!$C$7,Sheet1!
$A$8:$A$15,Sheet1!$C$8:$C$15,2)" _
And ThisSeriesCollection.Item(3).Name
= "Mar" _
And ThisSeriesCollection.Item
(3).Formula = "=SERIES(Sheet1!$D$7,Sheet1!
$A$8:$A$15,Sheet1!$D$8:$D$15,3)" Then
MsgBox("DataSource is Good")
End If
End If

Woot! Sometimes I surprise myself. LOL
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
Using a named range as a data source for a chart MichaelR Charts and Charting in Excel 4 June 16th 08 04:15 AM
Using a named range as a data source for a chart MichaelR Excel Worksheet Functions 0 June 15th 08 01:34 AM
Using a Named Range for Data Source In A Chart JoeP Charts and Charting in Excel 2 April 25th 07 02:33 AM
Setting Source Range For Chart James Stephens Excel Programming 4 March 4th 04 11:01 PM
change chart source from range to raw data daithimcc Excel Programming 2 December 27th 03 05:19 PM


All times are GMT +1. The time now is 06:22 PM.

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

About Us

"It's about Microsoft Excel"