Populating form text boxes from an array

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have created a function that does a few different calculations and returns
them as an array.

Function CalculationResults() As variant

Dim nResults(2) As Double
Dim oExcel As Excel.Application

Set oExcel = CreateObject("Excel.Application")
nResults(1) = oExcel.WorksheetFunction.Average(1, 2, 3)
nResults(2) = oExcel.WorksheetFunction.StDev(1, 2, 3)

CalculationResults = nResults()

End Function

I want to populate a couple of text boxes like:

textbox 1 --> control source : = CalculationResults (1)
textbox 2 --> control source : = CalculationResults (2)

but no go, I get #name error.
 
What about

textbox1.Value = CalculationResults (1)
textbox2.Value = CalculationResults (2)
 
Back
Top