Excel (VBA) hide specific worksheets

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

Hide specific worksheets in a workbook that contain a prefix. This example uses "Admin_", although this can be changed easily.

Copy this code and paste it in your HTML
  1. Sub HideAdminSheet()
  2. Dim ws As Worksheet
  4. For Each ws In ActiveWorkbook.Worksheets
  5. If Left(ws.Name, 6) = "Admin_" Then
  6. ws.Visible = xlSheetHidden
  7. End If
  8. Next ws
  10. End Sub

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.