Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88854

Is there a way to store a list of values from a loop?

$
0
0

I am trying to store a list of value from the third for loop into v(i). However, every time I start the program it stops right when it was going to store the value. I tried again with the current code below, but now it won't go through any of the steps.

Image

Public Function GaverSteh(a As Double, t As Double)
    Dim v() As Variant, k As Double, dx As Double, i As Double, z As Double, x As Double, sum As Double
    Dim N As Long
    ReDim v(1 To a)
    For i = 1 To a
        v(i) = v(i, 1)
    Next i
    i = 1
    For i = 1 To a
        For k = (i + 1) / 2 To Application.WorksheetFunction.Min(i, a / 2)
            z = z + ((Application.WorksheetFunction.Power(k, a / 2) * Application.WorksheetFunction.Fact(2 * k)) / (Application.WorksheetFunction.Fact(a / 2 - k) * Application.WorksheetFunction.Fact(k) * Application.WorksheetFunction.Fact(k - 1) * Application.WorksheetFunction.Fact(i - k) * Application.WorksheetFunction.Fact(2 * k - i)))
        Next k
        v(i) = z * Application.WorksheetFunction.Power(-1, (a / 2 + i))
    Next i
    For i = 1 To a
        x = i * Application.WorksheetFunction.Ln(2) / t
        sum = sum + v(i) * Laplase(x)
    Next i
    GaverSteh = Application.WorksheetFunction.Ln(2) / t * sum
End Function

Viewing all articles
Browse latest Browse all 88854

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>