#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15
Default Public variables

Hi, I need your help to solve a scope problem.

I want a variable that can be accessed in "ThisWorkBook", and other
Sheets.

I tried to create a public variable in "ThisWorkBook", but I got a
undefined error, when tried to use it at other sheets module....

Also, How can I create a procedure in "ThisWorkBook" and can be
accessed in other sheets.


Thanks for your help.

Johnny.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,290
Default Public variables

Put the Public variable in a standard module.
Code in all modules can then use it.

Place your procedure in a standard module and you can then
call it from any module ... Call MyOtherProcedure

If for some reason you must place the procedure in the ThisWorkbook
module, you can call it from another module with this syntax ...
Call ThisWorkbook.MyOtherProcedure
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"johnny"wrote in message
Hi, I need your help to solve a scope problem.
I want a variable that can be accessed in "ThisWorkBook", and other
Sheets.
I tried to create a public variable in "ThisWorkBook", but I got a
undefined error, when tried to use it at other sheets module....
Also, How can I create a procedure in "ThisWorkBook" and can be
accessed in other sheets.
Thanks for your help.
Johnny.
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15
Default Public variables

On Feb 23, 11:39 pm, "Jim Cone" wrote:
Put the Public variable in a standard module.
Code in all modules can then use it.

Place your procedure in a standard module and you can then
call it from any module ... Call MyOtherProcedure

If for some reason you must place the procedure in the ThisWorkbook
module, you can call it from another module with this syntax ...
Call ThisWorkbook.MyOtherProcedure
--
Jim Cone
San Francisco, USAhttp://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)

"johnny"wrote in message
Hi, I need your help to solve a scope problem.
I want a variable that can be accessed in "ThisWorkBook", and other
Sheets.
I tried to create a public variable in "ThisWorkBook", but I got a
undefined error, when tried to use it at other sheets module....
Also, How can I create a procedure in "ThisWorkBook" and can be
accessed in other sheets.
Thanks for your help.
Johnny.


Thanks a lot.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Public Variables Jerry McNabb Excel Discussion (Misc queries) 0 February 24th 08 01:26 AM
Declaring variables in Module vs. Public Jeff Excel Discussion (Misc queries) 5 November 19th 07 08:27 PM
Public Password Excel 2003 - SPB Excel Discussion (Misc queries) 2 May 23rd 07 11:08 PM
Using A Public Function / carl Excel Worksheet Functions 1 April 6th 06 09:13 PM
Public Curiosity BillCPA Excel Discussion (Misc queries) 1 December 5th 05 10:33 PM


All times are GMT +1. The time now is 01:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"