J
J
Jatecky2021-02-26 16:07:14
Visual Basic
Jatecky, 2021-02-26 16:07:14

How to fix error in Excel VBA formula?

There is a function code, but it throws an error. What's wrong?

Public Function fun1(x)
fun1=(x*x-5*2^0.5)/(2*x^3+1)
End Function

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BasiC2k, 2021-02-26
@Jatecky

If you have at the beginning of the module indicated:
Option Explicit
, then this means that an explicit indication of the types of variables is required. Then the function should look like this:

Public Function fun1(x As Double) As Double
fun1=(x*x-5*2^0.5)/(2*x^3+1)
End Function

If this is not the reason, post a screenshot of the error.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question