PC Review


Reply
Thread Tools Rate Thread

Re: Chart VBA

 
 
Jimmy
Guest
Posts: n/a
 
      21st Sep 2006
Jimmy wrote:
> Thanks for getting back to me, Andy.
>
> -------------------------------------------------------------------------------------------------------------
> XL02
> -------------------------------------------------------------
> In this case
> topright = E5 and
> bottomleft = Q9
>
> The goal is for Row6 to be plotted on the primary axis and for Rows
> 7-9 to be plotted on the secondary access.
>
> Here is a smattering of the chart data I use:
> E F G
> H I
> 5 Mar-00 Apr-04 Jun-04
> Apr-05
> 6 # of Bids/Quotes Received 768 117 1,050 172
> 7 % Submitted of Received 17.2% 8.5% 9.6% 19.2%
> 8 % Won to Date of Submitted 66.8% 2.5% 5.9% 8.2%
> 9 % Won to Date of Received 1.5% 2.0% 4.8% 4.3%
>
>
>
>
>
> ------------------------------------------------------------------------------------------------------------
>
> Another potential problem here is that my enduser has requested a
> custom-type chart called "Lines on Two Axes" and I am unfamiliar with
> how to code for this type of chart
>
> I am able to create this chart manually. The "record" code in concert
> with my lack of experience with this type of chart is a problem.
>
> Again, thanks-
> JR
>
> ---------------------------------------------------------------------------------------------------------------------------
>
>
> Andy Pope wrote:
> > Hi,
> >
> > Does the range defined by topleft and bottomright have enough columns to
> > have series placed on the secondary axis?
> > I would imagine trying to set the properties of the secondary axis that
> > does not exist would cause problems.
> >
> > Cheers
> > Andy
> >
> > Jimmy wrote:
> > > Hi,
> > > I am creating a chart in Excel.
> > > At lines 15-17 (see below) I get
> > > "Method 'Axes' of Object 'Chart_Chart' failed."
> > > Any help in getting this chart to create would be greatly appreciated.
> > > Thanks,
> > > Jimmy
> > >
> > >
> > > 2 Charts.Add
> > > 3 ActiveChart.ApplyCustomType ChartType:=xlBuiltIn,
> > > TypeName:= _
> > > 4 "Lines on 2 Axes"
> > > 5 ActiveChart.SetSourceData
> > > Source:=Sheets("Chart").Range(topLeft &
> > > ":" & bottomRight), PlotBy:= _
> > > 6 xlRows
> > > 7 ActiveChart.Location Where:=xlLocationAsObject,
> > > Name:="Chart"
> > > 8 With ActiveChart
> > > 9 .HasTitle = True
> > > 10 .ChartTitle.Characters.Text = "Bid/Quote Success Rate"
> > > 11 .Axes(xlCategory, xlPrimary).HasTitle = False
> > > 12 .Axes(xlValue, xlPrimary).HasTitle = True
> > > 13 .Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = _
> > >
> > > 14 "# of Bids/Quotes Received"
> > > 15 ' .Axes(xlCategory, xlSecondary).HasTitle = False
> > > 16 ' .Axes(xlValue, xlSecondary).HasTitle = True
> > > 17 ' .Axes(xlValue, xlSecondary).AxisTitle.Characters.Text
> > > = _
> > > 18 "% Submitted of Received or % Won to Date of
> > > Submitted/Received"
> > > 19 End With
> > >

> >
> > --
> >
> > Andy Pope, Microsoft MVP - Excel
> > http://www.andypope.info


 
Reply With Quote
 
 
 
 
Andy Pope
Guest
Posts: n/a
 
      22nd Sep 2006
Hi,

This code will produce your chart.
Don't worry about using the built-in custom type. You can create the
same thing yourself.

Sub Jimmy()

topleft = "E5"
bottomright = "I9"

Charts.Add
ActiveChart.SetSourceData Source:=Sheets("Chart").Range( _
topleft & ":" & bottomright), PlotBy:=xlRows
ActiveChart.Location Where:=xlLocationAsObject, Name:="Chart"
With ActiveChart
.ChartType = xlLine
.HasTitle = True
.ChartTitle.Characters.Text = "Bid/Quote Success Rate"
' move to secondary axis
For lngseries = 2 To .SeriesCollection.Count
.SeriesCollection(lngseries).AxisGroup = 2
Next

.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = _
"# of Bids/Quotes Received"
.Axes(xlCategory, xlSecondary).HasTitle = False
.Axes(xlValue, xlSecondary).HasTitle = True
.Axes(xlValue, xlSecondary).AxisTitle.Characters.Text = _
"% Submitted of Received or % Won to Date of Submitted/Received"
End With

End Sub

Cheers
Andy

Jimmy wrote:
> Jimmy wrote:
>
>>Thanks for getting back to me, Andy.
>>
>>-------------------------------------------------------------------------------------------------------------
>>XL02
>>-------------------------------------------------------------
>>In this case
>>topright = E5 and
>>bottomleft = Q9
>>
>>The goal is for Row6 to be plotted on the primary axis and for Rows
>>7-9 to be plotted on the secondary access.
>>
>>Here is a smattering of the chart data I use:
>> E F G
>> H I
>>5 Mar-00 Apr-04 Jun-04
>> Apr-05
>>6 # of Bids/Quotes Received 768 117 1,050 172
>>7 % Submitted of Received 17.2% 8.5% 9.6% 19.2%
>>8 % Won to Date of Submitted 66.8% 2.5% 5.9% 8.2%
>>9 % Won to Date of Received 1.5% 2.0% 4.8% 4.3%
>>
>>
>>
>>
>>
>>------------------------------------------------------------------------------------------------------------
>>
>>Another potential problem here is that my enduser has requested a
>>custom-type chart called "Lines on Two Axes" and I am unfamiliar with
>>how to code for this type of chart
>>
>>I am able to create this chart manually. The "record" code in concert
>>with my lack of experience with this type of chart is a problem.
>>
>>Again, thanks-
>>JR
>>
>>---------------------------------------------------------------------------------------------------------------------------
>>
>>
>>Andy Pope wrote:
>>
>>>Hi,
>>>
>>>Does the range defined by topleft and bottomright have enough columns to
>>>have series placed on the secondary axis?
>>>I would imagine trying to set the properties of the secondary axis that
>>>does not exist would cause problems.
>>>
>>>Cheers
>>>Andy
>>>
>>>Jimmy wrote:
>>>
>>>>Hi,
>>>>I am creating a chart in Excel.
>>>>At lines 15-17 (see below) I get
>>>>"Method 'Axes' of Object 'Chart_Chart' failed."
>>>>Any help in getting this chart to create would be greatly appreciated.
>>>>Thanks,
>>>>Jimmy
>>>>
>>>>
>>>>2 Charts.Add
>>>>3 ActiveChart.ApplyCustomType ChartType:=xlBuiltIn,
>>>>TypeName:= _
>>>>4 "Lines on 2 Axes"
>>>>5 ActiveChart.SetSourceData
>>>>Source:=Sheets("Chart").Range(topLeft &
>>>>":" & bottomRight), PlotBy:= _
>>>>6 xlRows
>>>>7 ActiveChart.Location Where:=xlLocationAsObject,
>>>>Name:="Chart"
>>>>8 With ActiveChart
>>>>9 .HasTitle = True
>>>>10 .ChartTitle.Characters.Text = "Bid/Quote Success Rate"
>>>>11 .Axes(xlCategory, xlPrimary).HasTitle = False
>>>>12 .Axes(xlValue, xlPrimary).HasTitle = True
>>>>13 .Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = _
>>>>
>>>>14 "# of Bids/Quotes Received"
>>>>15 ' .Axes(xlCategory, xlSecondary).HasTitle = False
>>>>16 ' .Axes(xlValue, xlSecondary).HasTitle = True
>>>>17 ' .Axes(xlValue, xlSecondary).AxisTitle.Characters.Text
>>>>= _
>>>>18 "% Submitted of Received or % Won to Date of
>>>>Submitted/Received"
>>>>19 End With
>>>>
>>>
>>>--
>>>
>>>Andy Pope, Microsoft MVP - Excel
>>>http://www.andypope.info

>
>


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
 
Reply With Quote
 
Jimmy
Guest
Posts: n/a
 
      25th Sep 2006
Thanks, Andy!

Andy Pope wrote:
> Hi,
>
> This code will produce your chart.
> Don't worry about using the built-in custom type. You can create the
> same thing yourself.
>
> Sub Jimmy()
>
> topleft = "E5"
> bottomright = "I9"
>
> Charts.Add
> ActiveChart.SetSourceData Source:=Sheets("Chart").Range( _
> topleft & ":" & bottomright), PlotBy:=xlRows
> ActiveChart.Location Where:=xlLocationAsObject, Name:="Chart"
> With ActiveChart
> .ChartType = xlLine
> .HasTitle = True
> .ChartTitle.Characters.Text = "Bid/Quote Success Rate"
> ' move to secondary axis
> For lngseries = 2 To .SeriesCollection.Count
> .SeriesCollection(lngseries).AxisGroup = 2
> Next
>
> .Axes(xlCategory, xlPrimary).HasTitle = False
> .Axes(xlValue, xlPrimary).HasTitle = True
> .Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = _
> "# of Bids/Quotes Received"
> .Axes(xlCategory, xlSecondary).HasTitle = False
> .Axes(xlValue, xlSecondary).HasTitle = True
> .Axes(xlValue, xlSecondary).AxisTitle.Characters.Text = _
> "% Submitted of Received or % Won to Date of Submitted/Received"
> End With
>
> End Sub
>
> Cheers
> Andy
>
> Jimmy wrote:
> > Jimmy wrote:
> >
> >>Thanks for getting back to me, Andy.
> >>
> >>-------------------------------------------------------------------------------------------------------------
> >>XL02
> >>-------------------------------------------------------------
> >>In this case
> >>topright = E5 and
> >>bottomleft = Q9
> >>
> >>The goal is for Row6 to be plotted on the primary axis and for Rows
> >>7-9 to be plotted on the secondary access.
> >>
> >>Here is a smattering of the chart data I use:
> >> E F G
> >> H I
> >>5 Mar-00 Apr-04 Jun-04
> >> Apr-05
> >>6 # of Bids/Quotes Received 768 117 1,050 172
> >>7 % Submitted of Received 17.2% 8.5% 9.6% 19.2%
> >>8 % Won to Date of Submitted 66.8% 2.5% 5.9% 8.2%
> >>9 % Won to Date of Received 1.5% 2.0% 4.8% 4.3%
> >>
> >>
> >>
> >>
> >>
> >>------------------------------------------------------------------------------------------------------------
> >>
> >>Another potential problem here is that my enduser has requested a
> >>custom-type chart called "Lines on Two Axes" and I am unfamiliar with
> >>how to code for this type of chart
> >>
> >>I am able to create this chart manually. The "record" code in concert
> >>with my lack of experience with this type of chart is a problem.
> >>
> >>Again, thanks-
> >>JR
> >>
> >>---------------------------------------------------------------------------------------------------------------------------
> >>
> >>
> >>Andy Pope wrote:
> >>
> >>>Hi,
> >>>
> >>>Does the range defined by topleft and bottomright have enough columns to
> >>>have series placed on the secondary axis?
> >>>I would imagine trying to set the properties of the secondary axis that
> >>>does not exist would cause problems.
> >>>
> >>>Cheers
> >>>Andy
> >>>
> >>>Jimmy wrote:
> >>>
> >>>>Hi,
> >>>>I am creating a chart in Excel.
> >>>>At lines 15-17 (see below) I get
> >>>>"Method 'Axes' of Object 'Chart_Chart' failed."
> >>>>Any help in getting this chart to create would be greatly appreciated.
> >>>>Thanks,
> >>>>Jimmy
> >>>>
> >>>>
> >>>>2 Charts.Add
> >>>>3 ActiveChart.ApplyCustomType ChartType:=xlBuiltIn,
> >>>>TypeName:= _
> >>>>4 "Lines on 2 Axes"
> >>>>5 ActiveChart.SetSourceData
> >>>>Source:=Sheets("Chart").Range(topLeft &
> >>>>":" & bottomRight), PlotBy:= _
> >>>>6 xlRows
> >>>>7 ActiveChart.Location Where:=xlLocationAsObject,
> >>>>Name:="Chart"
> >>>>8 With ActiveChart
> >>>>9 .HasTitle = True
> >>>>10 .ChartTitle.Characters.Text = "Bid/Quote Success Rate"
> >>>>11 .Axes(xlCategory, xlPrimary).HasTitle = False
> >>>>12 .Axes(xlValue, xlPrimary).HasTitle = True
> >>>>13 .Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = _
> >>>>
> >>>>14 "# of Bids/Quotes Received"
> >>>>15 ' .Axes(xlCategory, xlSecondary).HasTitle = False
> >>>>16 ' .Axes(xlValue, xlSecondary).HasTitle = True
> >>>>17 ' .Axes(xlValue, xlSecondary).AxisTitle.Characters.Text
> >>>>= _
> >>>>18 "% Submitted of Received or % Won to Date of
> >>>>Submitted/Received"
> >>>>19 End With
> >>>>
> >>>
> >>>--
> >>>
> >>>Andy Pope, Microsoft MVP - Excel
> >>>http://www.andypope.info

> >
> >

>
> --
>
> Andy Pope, Microsoft MVP - Excel
> http://www.andypope.info


 
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
Excel 2003 is missing Built-In Custom Chart Types in Chart Wizard Julius Microsoft Excel Programming 2 6th Mar 2009 05:55 PM
Excel 2003 is missing Built-In Custom Chart Types in Chart Wizard Julius Microsoft Excel Setup 1 6th Mar 2009 02:57 AM
Excel 2003 is missing Built-In Custom Chart Types in Chart Wizard Julius Microsoft Excel Programming 0 6th Mar 2009 02:21 AM
Cannot Activate Chart Area in Chart. Chart Object Failed ahperez@gmail.com Microsoft Excel Programming 2 8th Aug 2006 03:38 AM
pasting chart shows chart area, not the chart =?Utf-8?B?UGlyam8=?= Microsoft Powerpoint 3 13th Oct 2005 05:31 AM


Features
 

Advertising
 

Newsgroups
 


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