ErikG
New Member
This is one of those situations where I'm missing something really simple/fundamental and I will/should feel embarrassed when I get some help, but here goes...
I started having some trouble using the exponentiation operator "*" in VBA. The errors usually say that an end of statement is expected. So I created a simple UDF to illustrate my problem. The UDF just raises a given number to a given power or raises a given number to the second power. It looks something like this:
The errors I am getting back are Compile errors (either Expected: end of statement or Expected: )). I'm can't find examples of the exponentiation operator that are any more complex than "x = a^b". What am I missing? Many thanks in advance for your help!
I started having some trouble using the exponentiation operator "*" in VBA. The errors usually say that an end of statement is expected. So I created a simple UDF to illustrate my problem. The UDF just raises a given number to a given power or raises a given number to the second power. It looks something like this:
Code:
Public Function EXPO(a As Double) As Double
Dim b As Double
b = 2#
EXPO = a^b
End Function
OR
Public Function EXPO(a As Double, b As Double) As Double
EXPO = a^b
End Function
The errors I am getting back are Compile errors (either Expected: end of statement or Expected: )). I'm can't find examples of the exponentiation operator that are any more complex than "x = a^b". What am I missing? Many thanks in advance for your help!