View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tushar Mehta Tushar Mehta is offline
external usenet poster
 
Posts: 126
Default Unreachable public variables

Variables are VBA variables and visible only within VBA code. To make
them accessible from XL, create public functions that are then used as
user-defined-functions.' Do keep in mind that XL itself supports many
functions natively, including PI()

Const cPi=3.1415927
public function Pi():pi=cpi:end function

Then, in some cell, use =Pi()


--
Regards,

Tushar Mehta
www.tushar-mehta.com
Multi-disciplinary business expertise
+ Technology skills
= Optimal solution to your business problem
Recipient Microsoft MVP award 2000-2005

In article ,
says...
I define a group of public variables. I have a macro that initializes them.
They work fine through all my functions and subs. I have not found a way to
get my formulas in cells to see them. For example =A1*pi won't work. My
workaround has been to stick the value of pi in a cell and use a named range.
What's the real solution to using public vaiables in cell formulas??