Return to VBA Code Examples

VBA – Hide a Macro


Hide Macros with Private Subs

If you would like to hide a macro from appearing as an option in the Macro dialog box, it can be done by declaring it as Private.

The following are two macros, only the first one will appear to the user, the second is declared as Private so it will not be visible.



Sub Macro1()

     Call Macro2

End Sub



Private Sub Macro2()

     MsgBox "You can only see Macro1" 

End Sub

hide macro

Note: This only works if both Macros are in the same Module.

VBA Coding Made Easy

Stop searching for VBA code online. Learn more about AutoMacro – A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users!

alt text

Learn More!


<<Return to VBA Examples

vba-free-addin

VBA Code Examples Add-in

Easily access all of the code examples found on our site.

Simply navigate to the menu, click, and the code will be inserted directly into your module. .xlam add-in.

(No installation required!)

Free Download

Return to VBA Code Examples