Hi, I am trying to perform calculations on different columns in an Excel Spreadsheet in VBA, and for that I am using an exp() function. However, I get a result that the argument is not valid? How could I solve this issue?
Sub Exponent()
Dim save1 As Double
Dim save2 As Double
Dim save3 As Double
Dim Qconst1 As Integer
Dim Qconst2 As Integer
Dim Expon As Double
Qconst1 = -0.5 * Log(2 * WorksheetFunction.Pi) + Log(0.05)
Qconst2 = 1 / Sqr(2 * WorksheetFunction.Pi)
For i = 9 To 1266
Sheets(1).Cells(i, 16).Value = Qconst2 / Cells(i, 14) * WorksheetFunction.Exp(-0, 5 * Cells(i, 12) * Cells(i, 12) / Cells(i, 13) / Cells(i, 13)) * 0.01
Next i
End Sub
Bookmarks