Sqr built-in function in Excel 2003 VBA

D

DaleB

Hi:
I am seeing a discrepancy in Excel 2003 VBA
In the built-in Help , it lists the function Sqr as the VBA fucntion to
take the square root of a real argument. Notice that the S in Sqr is in
Upper Case. Similarly for other code examples within Excel and in David M.
Bourg's book, "Excel Scientific and Engineering Cookbook". But, when I am in
VBA inside of Excel it does not allow me to type (and keep) Sqr...it converts
the S to lower case s.
This works as a square root function, but is not the same syntax as Sqr.
Whiuch is correct ? Why does VBA's actual sytax (that used) not match what
is in the books, or the built-in Help ?

Another example that works correctly is the use of Tan() (with the upper
case T) for the tangent function.

Thank you

-DaleB
 
D

Dana DeLouis

Hi. At the top of your vba module, try typing the following with the Proper
syntax.

Dim Sqr

All your Sqr functions should not correct itself.
Now, delete the above Dim statement.
Hope this fixes it. :>)
 
J

JE McGimpsey

Somewhere in your code, you defined sqr as a variable or method, so the
VBE retains the lowercase s throughout the project.

You should be able to fix this by, after removing any other definitions
of sqr, entering

Dim Sqr As Long

then delete it.
 
D

DaleB

Thanx !

JE McGimpsey said:
Somewhere in your code, you defined sqr as a variable or method, so the
VBE retains the lowercase s throughout the project.

You should be able to fix this by, after removing any other definitions
of sqr, entering

Dim Sqr As Long

then delete it.
 
D

DaleB

Thanx !

Dana DeLouis said:
Hi. At the top of your vba module, try typing the following with the Proper
syntax.

Dim Sqr

All your Sqr functions should not correct itself.
Now, delete the above Dim statement.
Hope this fixes it. :>)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top