View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld[_2_] Ron Rosenfeld[_2_] is offline
external usenet poster
 
Posts: 1,045
Default Syntax in worksheet functions for individual values instead of ranges

On Sat, 8 Oct 2011 12:39:37 -0700 (PDT), REM wrote:

I am trying to use the TREND function in a macro but cannot work out
the syntax. I only need a single value result and can get the
following to put the correct value into the active cell:
ActiveCell.FormulaR1C1 = "=TREND({5;10},{10;20},15)"

But dont know how to evaluate this to a variable, without using a
cell.
Ideally I would like the numbers to be variables also.

Any help gratefully received.

Rod


Another approach:

Dim v As Variant
v = Application.WorksheetFunction.Trend(Array(5, 10), Array(10, 20), Array(15))
Debug.Print v(1)