Lloyd,
Firstly, I wouldn't use "Step" as the name of an argument; it's used by
VB
in a For/Next loop.
e.g. For i=1 To 10 Step 2
Also, you should mark the return type of you functions.
So a simlified version:
<Worksheet
Private Sub CommandButton1_Click()
MsgBox GetSimMinValue(10)(1, 1)
End Sub
</Worksheet
<Module
Function GetSimMinValue(WhichStep As Integer) As Double()
Dim Sims As Class1
Set Sims = New Class1
GetSimMinValue = Sims.MinValue(WhichStep)
End Function
</Module
<Class1
Public Function MinValue(WhichStep As Integer) As Double()
ReDim Mins(1 To 1, 1 To 2) As Double
MinValue = Mins
End Function
</Class1
NickHK
"pinkfloydfan" wrote in message
ups.com...
Hi there,
I wonder if anybody can explain to me why I am getting the #VALUE!
error here.
I have a function GetSimMinValue which accesses another function
MinValue built into a class module, the first function is:
Function GetSimMinValue(Identifier As Integer, Step As Integer) As
Double
GetSimMinValue = Simulations(Identifier).MinValue(Step)
End Function
This function accesses the following function in the class module:
Public Function MinValue(Step As Integer)
Dim i As Long
Dim Mins() As Double
ReDim Mins(1 To 1, 1 To 2)
' code here to set the values of Min()
MinValue = Mins
End Function
Having stepped through the function everything works fine until the
final line: MinValue=Mins which seems to be causing the error.
Does anybody have any ideas why?
Thanks in advance
Lloyd