![]() |
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. |
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. |
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. |
All times are GMT +1. The time now is 01:40 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com