it appears to be a precedence/order of operations problem. If you put
parens around -0.1 you get the same problem:
Sub Test2()
Dim c As Double
c = (-0.1) ^ 0.05
End Sub
Exponention appears to have a higher precedence than negation.
--
Regards,
Tom Ogilvy
"PatFinegan " wrote in message
...
Sub Test1 below generates an "invalid procedure call or argument" error
(#5) in Excel 97 and Excel 2003 on all of my PCs. Sub Test2 does not.
Can anyone replicate this? If so, can anyone explain the problem, or
provide a workaround other than writing the variables to cells and
performing the calculations there? Thanks in advance.
Sub Test1()
Dim a As Double, b As Double, c As Double
a = -0.1
b = 0.05
c = a ^ b
End Sub
Sub Test2()
Dim c as Double
c = -0.1 ^ 0.05
End Sub
---
Message posted from http://www.ExcelForum.com/