View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
shelfish shelfish is offline
external usenet poster
 
Posts: 39
Default How to set an arg list for my VBA functions

Many thanks. I'm getting a "User defined type not defined..." error.
Here's what I've got:

Public Enum thisLabelArg1
cumChartLabels = 1
monthlyCountChartLabels = 2
top5ChartLabels = 3
End Enum

Public Enum thisLabelArg2
Chart Title = 1
X_Axis_Label = 2
Primary_Axis_Label = 3
Secondary_Axis_Label = 4
End Enum

Function thisLabel(labelSeries As thisLabelArg1, labelType As
thisLabelArg2) As String ## Error on this line ##

If labelSeries = 1 Then Set thisChartLabel = cumChartLabels
ElseIf labelSeries = 2 Then Set thisChartLabel =
monthlyCountChartLabels
ElseIf labelSeries = 3 Then Set thisChartLabel =
top5ChartLabels
End If
If labelType = 1 Then findLabelType = "Chart Title"
ElseIf labelType = 2 Then findLabelType = "X Axis"
ElseIf labelType = 3 Then findLabelType = "Primary"
ElseIf labelType = 4 Then findLabelType = "Secondary"
End If

thisLabel = Range("'" & chartDataSheetName & "'!" &
thisChartLabel.Find(labelType).Offset(1, 0).Address).Value

End Function

thisLabel = Range("'" & chartDataSheetName & "'!" &
thisChartLabel.Find(labelType).Offset(1, 0).Address).Value

End Function

Sub...
....ChartTitle.Characters.Text = thisLabel(cumChartLabels, "Chart
Title")
End Sub