Hide & Protect the sheets


/ Published in: Visual Basic
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.