I am using VBA to integrate in Excel. I have a multitude of variables necessary to the integration process in an organized table on the sheet that will be changed as needed. I have written the following code to accomplish this and have successfully debugged said code so that it is compiling without error.

```
Dim dIdt As Range
Dim Isnp As Range
Dim Tau As Range

Dim A As Range
Dim B As Range
Dim C As Range
Dim D As Range

Function Iscr(t)
Set dIdt = Worksheets("Sheet1").Range("F11").Value
Set Isnp = Worksheets("Sheet1").Range("F14").Value
Set Tau = Worksheets("Sheet1").Range("F13").Value
Iscr = (dIdt * t) + (Isnp * (Exp((-t) / Tau)))
End Function

Function Econd1A(t)
Set A = Worksheets("Sheet1").Range("B17").Value
Set B = Worksheets("Sheet1").Range("B18").Value
Set C = Worksheets("Sheet1").Range("B19").Value
Set D = Worksheets("Sheet1").Range("B20").Value
Econd1A = A + (B * (Log(Iscr(t)))) + (C * (Iscr(t))) + (D * (Iscr(t) ^ (1 / 2)) * Iscr(t))
End Function

Function Econd1(x0, t1, t2)

'define range of integral
int_range = t2 - t1

'discretize the integral into n slices dt wide
n = 1000
dt = int_range / n

'initialize variables
ta = t1
tb = ta + dt
Econd1 = x0

'calculate areas using trapezoidal rule

'sum area under curve of each slice
For j = 1 To n
Econd1 = Econd1 + (tb - ta) * (Econd1A(ta) + Econd1A(tb)) / 2
ta = tb
tb = ta + dt
Next

End Function

```

I am now at a loss in regards to debugging as the error does not seem to be VBA related.

The cell's expected output is .0127, but it is instead giving a #VALUE! error.