excel - use a created function within a function vba -


im making vba function calculate integral using trapezoidal rule how can apply function created in vba use in function...heres code ( worksheet.function did not work)

option explicit  function funcion(x double) double     funcion = 3 * (x ^ 3) + 5 * (x ^ 2) - 10 * x + 20 end function  function sumatoria(a double, n double, h double) double     dim integer     dim sum double      = 0     sum = 0      while (i <= n - 1)         sum = sum + worksheetfunction.funcion(a + * h)          = + 1     loop      sumatoria = sum   end function 

this works :

function sumatoria(a double, n double, h double) double      dim integer     dim sum double     dim temp double      = 0     sum = 0      while (i <= n - 1)         temp = + * h         sum = sum + funcion(temp)          = + 1     loop      sumatoria = sum   end function 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -