MrExcel Publishing
Your One Stop for Excel Tips & Solutions

How to hide macro name in menu

Posted by Eli Weiss on February 11, 2002 12:52 AM

I have macro (2) within macro (1)
How can I hide macro (2) name in the menu so that
nobody will activate it accidently
Many thanks

Posted by Damon Ostrander on February 11, 2002 2:09 PM

Hi Eli,

I assume you mean that macro 2 and macro 1 reside in the
same macro module and one calls the other, not that one is
"within" the other, since one macro cannot reside within
another in VBA.

If you don't want a macro to show up in the Macro Run
dialog, simply declare it as Private by putting the
Private keyword in front of the Sub statement, e.g.,

Private Sub Macro2()

Other macros IN THE SAME MACRO MODULE will still be
able to call it. The same applies to UDFs.