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: 2,069
Default Program a combination chart using VBA

I use excel 2003 and when I try to use the macro recoder to create a custom
chart type of "Line - Column on 2 Axes" the recoder creates the following
code and an example of the data is below the code. The chart that is creaded
the first time when recording the macro is perfect.

However when I try to excute the macro I either receive an error message
runtime error 1004, "Methods axes of object - chart failed when I name the
axes of the Series or

I simply have a column chart and not a combination chart.

What I am trying to do is have a single chart that shows staff in column and
Volumn in line by time of day. I can make it work perfect by hand but I am
unable to write a VBA routine that will accomplish the same thing again. VBA
acts like it doesn't reconize the Chart Type.

Please help and Thanks in advance

'Macro Code
Charts.Add
ActiveChart.ApplyCustomType ChartType:=xlBuiltIn, TypeName:= _
"Line - Column on 2 Axes"
ActiveChart.SetSourceData
Source:=Sheets("Data").Range("B37:D61"),PlotBy:= _ xlColumns
ActiveChart.Location Whe=xlLocationAsObject, Name:="Data"
With ActiveChart.Axes(xlCategory)
.HasMajorGridlines = False
.HasMinorGridlines = False
End With
With ActiveChart.Axes(xlValue)
.HasMajorGridlines = True
.HasMinorGridlines = False
End With
ActiveChart.HasLegend = True
ActiveChart.Legend.Select
Selection.Position = xlBottom
With Selection.Interior
.ColorIndex = 36
.Pattern = 1
End With
End Sub

Spread Sheet Data
Col B Col C Col D
Row 37 Hours Staff Volumn
Row 38 0:00 2 52280
Row 39 1:00 2 52280
Row 40 2:00 2 52280
Row 41 3:00 1 52280
Row 42 4:00 0 52280
Row 43 5:00 0 52280
Row 44 6:00 0 52280
Row 45 7:00 0 52280
Row 46 8:00 0 95280
Row 47 9:00 0 58380
Row 48 10:00 0 52380
Row 49 11:00 0 58980
Row 50 12:00 4 81280
Row 51 13:00 4 117080
Row 52 14:00 4 70880
Row 53 15:00 3 96100
Row 54 16:00 4 91900
Row 55 17:00 4 27600
Row 56 18:00 3 62300
Row 57 19:00 2 44900
Row 58 20:00 2 22700
Row 59 21:00 2 9000
Row 60 22:00 2 0
Row 61 23:00 2 0

 
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
Combination chart Risky Dave Charts and Charting in Excel 3 May 3rd 09 01:56 PM
Combination of stock chart and line chart hwatari Charts and Charting in Excel 2 September 24th 07 10:52 PM
combination chart alas Charts and Charting in Excel 1 August 8th 06 05:42 PM
How to lock combination chart in pivot chart? Marcos Novaki Charts and Charting in Excel 1 April 13th 05 10:05 PM
combination chart hwatari Charts and Charting in Excel 1 December 19th 04 09:58 PM


All times are GMT +1. The time now is 10:29 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"