PC Review


Reply
Thread Tools Rate Thread

Access a VBA global variable/constant from a worksheet cell

 
 
Lina
Guest
Posts: n/a
 
      28th Jul 2008
I want to declare several constants in VBA that should be accessible from the
worksheet cells.
Is it at all possible? I tried several combinations of GLOBAL, PUBLIC,
inside workbook/workbook_open, inside workbook/general, inside a user
module/general, inside a user module/some function. Can get the value
displayed in a MsgBox and the like, but whenever I try to assign it to a cell
I get the #NAME error. I know I could just assign it to some hidden cell in
the workbook but I thought there must be a cleaner solution...

Thanks in advance!
Lina
 
Reply With Quote
 
 
 
 
Lina
Guest
Posts: n/a
 
      29th Jul 2008
Both suggestions were great, that solved it!
Thanks a lot!
Lina

"Lina" wrote:

> I want to declare several constants in VBA that should be accessible from the
> worksheet cells.
> Is it at all possible? I tried several combinations of GLOBAL, PUBLIC,
> inside workbook/workbook_open, inside workbook/general, inside a user
> module/general, inside a user module/some function. Can get the value
> displayed in a MsgBox and the like, but whenever I try to assign it to a cell
> I get the #NAME error. I know I could just assign it to some hidden cell in
> the workbook but I thought there must be a cleaner solution...
>
> Thanks in advance!
> Lina

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stopping a constant variable cell from being copied. Link Microsoft Excel New Users 3 15th May 2007 03:35 AM
Re: Variable worksheet name (tab) linked to cell in same worksheet Don Guillett Microsoft Excel Worksheet Functions 4 9th Jan 2007 08:37 PM
Global variable in DLL and access from C# gilad@arbingersysBADSPAMBOT.com Microsoft C# .NET 0 21st Jan 2005 10:23 PM
How to copy formatting when moving from cell to variable to another cell on another worksheet kls Microsoft Excel Programming 1 11th Sep 2004 10:42 PM
Referring to a local or global variable or constant dynamically? PC Microsoft Excel Programming 1 15th Sep 2003 02:31 PM


Features
 

Advertising
 

Newsgroups
 


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