View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default 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