View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Nick Hodge Nick Hodge is offline
external usenet poster
 
Posts: 1,173
Default bizarre "invalid procedure call" error

Pat

Replicate...yes...reason no.... It appears to be the - sign in the
variable. remove the sign and all is well. Negate it later and all is well
too

Sub Test1()
Dim a As Double, b As Double, c As Double
a = 0.1
b = 0.05
c = -(a ^ b)
Debug.Print c
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"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/