Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using PI in a macro
I know PI can be used in a formula in for a cell. I am writing a macro to
provide the same formula while process other data. When I try to use it, I get a compile error, sub or function not defined. It is a complicated formula but (Cos(D1031 * Pi() / 180)...... Is there some thing I have to use PI? Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using PI in a macro
You can use Application.Pi. E.g,
(Cos(D1031 * Application.Pi() / 180)...... -- Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) "Nils Titley" wrote in message ... I know PI can be used in a formula in for a cell. I am writing a macro to provide the same formula while process other data. When I try to use it, I get a compile error, sub or function not defined. It is a complicated formula but (Cos(D1031 * Pi() / 180)...... Is there some thing I have to use PI? Thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using PI in a macro
pi = 4*Atn(1)
-- Gary''s Student - gsnu200773 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using PI in a macro
When I try to use it (Pi() ), I get a compile error, sub or function not
defined Hi. You need to use "WorksheetFunction.Pi" However, this looks terrible in a formula. Here are some general ideas for using a variable. Sub Demo1() Debug.Print WorksheetFunction.Pi Dim Pi, Deg Pi = [Pi()] Deg = [Pi()/180] Debug.Print Pi Debug.Print Sin(90 * Deg) End Sub If you have a little imagination, here is Character 0182 used as Pi. Probably not useful though. Sub Demo2() Dim ¶ As Double 'Alt + 0182 ¶ = [Pi()] Debug.Print Cos(45 * ¶ / 180) End Sub -- HTH :) Dana DeLouis "Nils Titley" wrote in message ... I know PI can be used in a formula in for a cell. I am writing a macro to provide the same formula while process other data. When I try to use it, I get a compile error, sub or function not defined. It is a complicated formula but (Cos(D1031 * Pi() / 180)...... Is there some thing I have to use PI? Thanks |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using PI in a macro
Thanks all for responding. I am using the Application.Pi(). It is working
but I will also try the others. "Nils Titley" wrote: I know PI can be used in a formula in for a cell. I am writing a macro to provide the same formula while process other data. When I try to use it, I get a compile error, sub or function not defined. It is a complicated formula but (Cos(D1031 * Pi() / 180)...... Is there some thing I have to use PI? Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
Macro not showing in Tools/Macro/Macros yet show up when I goto VBA editor | Excel Programming | |||
Need syntax for RUNning a Word macro with an argument, called from an Excel macro | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |