Thread: Hide a Macro
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Hide a Macro

Alt + F11 to open VBEditor.

Select your workbook.

Right-click on it and select VBAProject PropertiesProtectionLock for viewing
and give a password.

Note: you must save the file before the locking takes effect.


Gord Dibben MS Excel MVP



On Wed, 25 Jul 2007 04:46:17 -0700, wrote:

Hi all,

I have a multiple worksheets which i wish to password protect. I have
done so using the following VBA code:

Sub ProtectAllSheets()
Application.ScreenUpdating = False
Dim n As Single
For n = 1 To Sheets.Count
Sheets(n).Protect Password:="XXXX"
Next n
Application.ScreenUpdating = True
End Sub


Sub UnprotectAllSheets()
Application.ScreenUpdating = False
Dim n As Single
For n = 1 To Sheets.Count
Sheets(n).Unprotect Password:="XXXX"
Next n
Application.ScreenUpdating = True
End Sub

I do not wish others to be able to view this code as it defeats the
purpose of password protecting it.

How do i hide this macro but still be able to run it at my own
expense?

Cheers,
Grant.