View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
The Dude The Dude is offline
external usenet poster
 
Posts: 14
Default Declaring subs Public vs Private

A private sub will be seen only inside the module, that is you cannot call it
from another module.

A public sub (default) is seen from everywhere by everyone.

The main advantage I see about private subs are that they don't show in the
dialog when you press the "Play" button on the VBA toolbar - though you can
still call them by typing the entire name. Also the fact that they cannot be
called from other modules can prevent mistakes if you ever want to use the
same name for two subs (which is not recommended anyways but...).

"Rick" wrote:

When is it correct to declare a sub Public vs Private? What is the advantage?