Public is not Public

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,

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

Clara
 
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,
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top