Hello all,
Grateful for any advice on the following...I have a UDF 'GetHighPoint' which goes to an internal database and pulls back a list of data (results stored in high = Qry1.Data) and from this list the excel function MAX will find the highest value, thus the spreadsheet only sees one value(i.e the highest number)
My code is below but always brings back #Value in excel.
Any ideas as to why this keeps happening?
I think my references to the UDF variables is incorrect but not sure how they should be formatted.
Thanks for the replies.
Function GetHighPoint(id As Variant, StartDate As Date, EndDate As Date) As Variant
Dim high()
Dim i As Integer
Set Qry1 = New Qry
With Qry1
.ErrorMode = EXCEPTION
.InstrumentIDList = [id].Value
.FieldList = "HIGH"
.Mode = "START:[STARTDATE].value END:[ENDDATE].value"
.RequestAll
high = Qry1.Data
End With
ActiveCell.FormulaR1C1 = "=MAX([high].value)
Grateful for any advice on the following...I have a UDF 'GetHighPoint' which goes to an internal database and pulls back a list of data (results stored in high = Qry1.Data) and from this list the excel function MAX will find the highest value, thus the spreadsheet only sees one value(i.e the highest number)
My code is below but always brings back #Value in excel.
Any ideas as to why this keeps happening?
I think my references to the UDF variables is incorrect but not sure how they should be formatted.
Thanks for the replies.
Function GetHighPoint(id As Variant, StartDate As Date, EndDate As Date) As Variant
Dim high()
Dim i As Integer
Set Qry1 = New Qry
With Qry1
.ErrorMode = EXCEPTION
.InstrumentIDList = [id].Value
.FieldList = "HIGH"
.Mode = "START:[STARTDATE].value END:[ENDDATE].value"
.RequestAll
high = Qry1.Data
End With
ActiveCell.FormulaR1C1 = "=MAX([high].value)