Simple VBA Global Delorations?

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top