Doogle, thank you so much!
So I didn't put limits on X before because those limits will depend on the ERange (range of the electron), and I will have to integrate (using the trapezoidal rule). I had written as follows:

Function CalculatePhi(T As Double, S As Double) As Double
Dim X As Long, Phi() As Double, i As Double, Combo() As Double
ReDim Phi(S, T), Combo(T, S, X, Rc, Rn)

X = 0
Phi(T, S) = 0
For i = 0 To nmax
X = i * 1 / 1000 'step size is 1 nm(everything else is in micrometers)
Phi(T, S) = Phi(T, S) + ((X + 1 / 100) - X) * (Combo(i + 1 / 1000) - Combo(i)) / 2
Next i
End Function