ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Simple VBA Global Delorations? (https://www.excelbanter.com/excel-programming/314487-simple-vba-global-delorations.html)

Chris

Simple VBA Global Delorations?
 
Hi All

I am trying to write a series of functions in VBA for Excel 97.
I want to declare a series of constants (calculated by trigonometry within
module) at the start of my module for use throughout all the functions.
Can I do this and how?
( I tried to declare them as const but I got an error on the trig
functions.)

Thanks

Chris



Tom Ogilvy

Simple VBA Global Delorations?
 
A constant is not calculated. You can use a public variable.

Public MyTrigVal1 as Double

Sub InitMyTrigVal1()
MyTrigVal1 = SomeTrigFunction
End Sub

The trick is when do you want InitMyTrigVal1 to be run. Call it from the
workbook_Open event?

See Chip Pearson's page on Events
http://www.cpearson.com/excel/events.htm

--
Regards,
Tom Ogilvy

"Chris" wrote in message
...
Hi All

I am trying to write a series of functions in VBA for Excel 97.
I want to declare a series of constants (calculated by trigonometry within
module) at the start of my module for use throughout all the functions.
Can I do this and how?
( I tried to declare them as const but I got an error on the trig
functions.)

Thanks

Chris






All times are GMT +1. The time now is 08:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com