ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Public is not Public (https://www.excelbanter.com/excel-programming/389649-public-not-public.html)

clara

Public is not Public
 
Hi all,

Why a public sub (defined in a sheet module ) can not be called in code
behind another sheet ?

Clara
--
thank you so much for your help

Norman Jones

Public is not Public
 


--
---
Regards,
Norman
Microsoft Excel MVP



"clara" wrote in message
...
Hi all,

Why a public sub (defined in a sheet module ) can not be called in code
behind another sheet ?

Clara
--
thank you so much for your help




Norman Jones

Public is not Public
 
Hi Clara

A public procedure should be placed in a standard module,
not a sheet module. Try, therefore, moving the code to a
standard module and your problem should be resolved.

In general, a sheet mpodule should only be used for sheet
event code,


---
Regards,
Norman


"clara" wrote in message
...
Hi all,

Why a public sub (defined in a sheet module ) can not be called in code
behind another sheet ?

Clara
--
thank you so much for your help




Norman Jones

Public is not Public
 
Hi Clara,

For additional information on the use of code modules,
see Chip Pearson at:

Code Module And Code Names
http://www.cpearson.com/excel/codemods.htm


---
Regards,
Norman
Microsoft Excel MVP



JE McGimpsey

Public is not Public
 
Since sheet modules are a class module you need to qualify the sub name.
For instance, if your public sub in Sheet1 is "test", then in the Sheet2
code module, use

Call Sheet1.test

Note that you should use the sheet's code name as the qualifier.


In article ,
clara wrote:

Why a public sub (defined in a sheet module ) can not be called in code
behind another sheet ?



All times are GMT +1. The time now is 05:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com