Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
Maybe I'm too tired to see the obvious, could somebody explain why this
simple function is producing 0 instead of a result? Public Function AreaCircle(Radius) As Double Const conPi As Single = 3.141592 AreaofCircle = conPi * (Radius ^ 2) End Function If I run it as a sub procedure it works fine. TIA |
#2
![]() |
|||
|
|||
![]()
Try:
Public Function AreaofCircle(Radius) As Double Const conPi As Single = 3.141592 AreaofCircle = conPi * (Radius ^ 2) End Function or Public Function AreaCircle(Radius) As Double Const conPi As Single = 3.141592 AreaCircle = conPi * (Radius ^ 2) End Function Depending on your preference - the function name is different to the variable Regards Trevor "headly" wrote in message ... Maybe I'm too tired to see the obvious, could somebody explain why this simple function is producing 0 instead of a result? Public Function AreaCircle(Radius) As Double Const conPi As Single = 3.141592 AreaofCircle = conPi * (Radius ^ 2) End Function If I run it as a sub procedure it works fine. TIA |
#3
![]() |
|||
|
|||
![]()
If you used Option Explicit, this would have been obvious to you.
-- HTH Bob Phillips "Trevor Shuttleworth" wrote in message ... Try: Public Function AreaofCircle(Radius) As Double Const conPi As Single = 3.141592 AreaofCircle = conPi * (Radius ^ 2) End Function or Public Function AreaCircle(Radius) As Double Const conPi As Single = 3.141592 AreaCircle = conPi * (Radius ^ 2) End Function Depending on your preference - the function name is different to the variable Regards Trevor "headly" wrote in message ... Maybe I'm too tired to see the obvious, could somebody explain why this simple function is producing 0 instead of a result? Public Function AreaCircle(Radius) As Double Const conPi As Single = 3.141592 AreaofCircle = conPi * (Radius ^ 2) End Function If I run it as a sub procedure it works fine. TIA |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
FV Function Problem | Excel Worksheet Functions | |||
Function formula for simple worksheet | New Users to Excel | |||
Automatically up date time in a cell | Excel Discussion (Misc queries) | |||
Simple, Monday morning brain function | Excel Worksheet Functions | |||
Simple, Monday morning brain function | Excel Worksheet Functions |