You are on page 1of 1

Sub UnprotectAndShowSheets()

Dim ws As Worksheet
Dim strPassword As String
strPassword = "Oman@2024" ' Update the password as needed

' Disable alerts to prevent popup messages during the process


Application.DisplayAlerts = False

' Loop through each worksheet in the workbook


For Each ws In ThisWorkbook.Worksheets
On Error Resume Next ' If an error occurs, skip to the next worksheet
If ws.Visible = xlSheetVeryHidden Then
' Attempt to unprotect the worksheet with the password
ws.Unprotect Password:=strPassword

' Attempt to make the sheet visible


ws.Visible = xlSheetVisible
End If
On Error GoTo 0 ' Turn back on regular error handling
Next ws

' Re-enable alerts after operation is complete


Application.DisplayAlerts = True

MsgBox "Process complete.", vbInformation, "Unprotect and Show Sheets"


End Sub

You might also like