Hi Bob,
many thanks for your reply.
Agree with you, that would make it easier to read.Originally Posted by xld
Again, fully agree, though I wasn't quite sure how to do this, as I was using 'With End With' operators and didn;t know how to pass the specific generic routines through.Originally Posted by xld
For example there are 2 that need to be called, but needed some help writing them:
Routine 1:
[vba]Case "CHART 51"
With chtObj.Chart
.HasTitle = True
.ChartTitle.Text = "Number of Type1 Claims 1987 - 1998"
For Each mySrs In .SeriesCollection
With mySrs
Debug.Print UCase(.Name)
Select Case UCase(.Name)
Case "ACTUAL"
strTemp = WorksheetFunction.Substitute(.Formula, "'Section 4'!$B$218:$S$218", "'Section 4'!$B$238:$S$238")
.Formula = strTemp
Case "FORECAST"
strTemp = WorksheetFunction.Substitute(.Formula, "'Section 4'!$B$219:$S$219", "'Section 4'!$B$245:$S$245")
.Formula = strTemp
End Select
End With ' mySrs
Next mySrs
wksht.Activate
Range("A1").Select[/vba]
Routine 2:
[vba]'------------------------------------------
' Call the macro to update the chart scale
' Y-Axis scale to dsiplay the
' MINIMUM and MAXIMUM values
'------------------------------------------
ActiveSheet.ChartObjects(chtObj.Name).Activate
ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue)
.MinimumScaleIsAuto = True
.MaximumScaleIsAuto = True
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
.Crosses = xlAutomatic
.ReversePlotOrder = False
.ScaleType = xlLinear
.DisplayUnit = xlNone
End With
wksht.Activate
Range("A1").Select
End With ' chtObj.Chart[/vba]
Any ideas how to make the bold code above generic Private Functions to call on repeatedly, for example?
Really keen to hear your thoughts.