Thread: Pi in VBA?
View Single Post
  #14   Report Post  
Posted to microsoft.public.excel.programming
joeu2004 joeu2004 is offline
external usenet poster
 
Posts: 2,059
Default Pi in VBA?

"Prof Wonmug" wrote:
On Tue, 28 Apr 2009 03:17:37 -0400, "Rick Rothstein" wrote:
You didn't like this one?
PI = 4 * ATN(1)


I did. It was my second choice. Using the worksheet
function is a little more obvious, that's all.


..... And more likely to be accurate insofar as matching the Excel value. I
agree.

__You__ were the one who was asking for a VB-only solution, or so it seemed.


----- previous message -----

"Prof Wonmug" wrote in message
...
What's the best way to get the most accurate value for pi in a VBA
function?

Excel 2007 has a pi() worksheet function, but there doesn't appear to
be a corresponding VBA function. The best I could come up with is

C = 2 * Application.WorksheetFunction.Pi() * R

That works, but it's a litte messy.