LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Chart Creation using VBA

I recorded a chart creation event macro and then tried to paste it into
my project. It always fails on line #15 (see below). What am I doing
wrong? And what shoud I do to fix it?
Thank you,
jimmy




1 Sub Chartwork1()
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 Whe=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
20 ActiveChart.HasLegend = False
21 ActiveChart.HasDataTable = True
22 ActiveChart.DataTable.ShowLegendKey = True
23 ActiveChart.Axes(xlValue).Select
24 With ActiveChart.Axes(xlValue)
25 .MinimumScale = 1000
26 .MaximumScale = 5000
27 .MinorUnit = 1000
28 .MajorUnit = 1000
29 .Crosses = xlCustom
30 .CrossesAt = 1000
31 .ReversePlotOrder = False
32 .ScaleType = xlLinear
33 .DisplayUnit = xlNone
34 End With
35 ActiveChart.Axes(xlValue, xlSecondary).Select
36 With ActiveChart.Axes(xlValue, xlSecondary)
37 .MinimumScaleIsAuto = True
38 .MaximumScale = 1
39 .MinorUnit = 0.2
40 .MajorUnit = 0.2
41 .Crosses = xlAutomatic
42 .ReversePlotOrder = False
43 .ScaleType = xlLinear
44 .DisplayUnit = xlNone
45 End With
46 ActiveChart.SeriesCollection(1).Select
47 With Selection.Border
48 .ColorIndex = 1
49 .Weight = xlThick
50 .LineStyle = xlContinuous
51 End With
52 With Selection
53 .MarkerBackgroundColorIndex = xlAutomatic
54 .MarkerForegroundColorIndex = xlAutomatic
55 .MarkerStyle = xlNone
56 .Smooth = True
57 .MarkerSize = 9
58 .Shadow = False
59 End With
60 ActiveChart.SeriesCollection(1).AxisGroup = 2
61 End Sub

 
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
chart creation P. Zicari Charts and Charting in Excel 4 October 25th 07 11:16 PM
Chart creation Harddrive747 Charts and Charting in Excel 2 October 23rd 06 03:17 AM
Excel chart creation biffbowl Excel Discussion (Misc queries) 0 March 17th 06 08:27 PM
Bar of Pie chart - Need Bar creation Craigm[_26_] Excel Programming 1 July 6th 05 12:11 AM
Chart creation ceiling in Excel 2002 via Chart.Add ? Daniel S. Excel Programming 3 August 21st 03 12:06 AM


All times are GMT +1. The time now is 09:40 PM.

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"