Posted By

Hassito on 06/05/13


Tagged


Versions (?)

Hide & Protect the sheets


 / Published in: Visual Basic
 

This code enables the protection of the sheet with a password and then hides all the sheets.

  1. Private Sub CommandButton_Click()
  2.  
  3. Application.ScreenUpdating = False
  4.  
  5. Dim wSheet As Worksheet
  6. Dim Pwd As String
  7.  
  8. 'Pwd = InputBox("Enter your password to protect all worksheets", "Password Input")
  9. For Each wSheet In Worksheets
  10. wSheet.Protect Password:="EE"
  11. Next wSheet
  12.  
  13.  
  14.  
  15. ActiveWindow.DisplayWorkbookTabs = False
  16.  
  17.  
  18.  
  19. End Sub

Report this snippet  

You need to login to post a comment.