Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Putting the series 1 and series 2 titles from a worksheet

This is the code I have to use 2 rows in a worksheet to create a clustered column chart. I'm currently getting an error with the series collection 2 name.

Any help would be greatly appreciated!!

Jeff


Sub TwoRowsBarChart()

Dim i As Integer, shName As String
Dim rowData As Range, rowXAxis As Range
Dim chtTitle As Range
Dim series1Title As Range

' *** CUSTOMIZE ***
shName = "March_20052006_OGT Query"
Set rowData = Sheets(shName).Range("f2:k3")
Set rowXAxis = Sheets(shName).Range("f1:k1")
Set chtTitle = Sheets(shName).Range("d2")
Set series1Title = Sheets(shName).Range("b2")

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

'
'
'
'
'
For i = 0 To 84
Charts.Add
With ActiveChart
.ChartType = xlColumnClustered
.SetSourceData Source:=rowData.Offset(i, 0), _
PlotBy:=xlRows
.SeriesCollection(1).XValues = rowXAxis
.HasLegend = False
.HasTitle = True
.ChartTitle.Characters.Text = chtTitle.Offset(i, 0)
.SeriesCollection(1).Name = series1Title.Offset(i, 0)
.SeriesCollection(2).Name = series1Title.Offset(i + 1, 0)
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = _
"Percent Passing"
With .Axes(xlValue)
.MinimumScale = 0
.MaximumScale = 1
.MinorUnit = 0.1
.MajorUnit = 0.2
.TickLabels.NumberFormat = "0%"
End With

' *** NOTE ***
' I cannot test the following.
' Change #If 0 to #If 1.
' If it works for you, remove #If and #End
' directives
#If 0 Then
.SetElement (msoElementPrimaryValueAxisTitleVertical)
.SetElement (msoElementChartTitleAboveChart)
#End If
End With
ActiveChart.Deselect
Next i

Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True

'
Sheets(shName).Activate
Range("a1").Activate

End Sub

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
User Selectable Series and Number of Series for Line Chart Dave in NJ Charts and Charting in Excel 2 February 23rd 09 12:18 AM
series titles dips1 Charts and Charting in Excel 1 November 4th 07 08:22 PM
chart data series -- plot a table as a single series hjc Charts and Charting in Excel 7 September 20th 05 05:52 PM
series graph -- one series being added to another series rich zielinski via OfficeKB.com Charts and Charting in Excel 3 March 30th 05 06:23 PM
Filling in a Date Series using the Fill | Series menu command Bob C Excel Programming 3 February 1st 05 11:13 PM


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