Last active
May 4, 2024 22:08
-
-
Save quickstep25/69ed165bff33301b251ed563be19d43f to your computer and use it in GitHub Desktop.
Code to unhide all Excel worksheets within a workbook.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' PASTE INTO IMMEDIATE WINDOW | |
for each sh in worksheets: sh.visible=true: next sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' MACRO to unhide all workbook worksheets | |
Sub Unhide_All_Sheets() | |
Dim wks As Worksheet | |
For Each wks In ActiveWorkbook.Worksheets | |
wks.Visible = xlSheetVisible | |
Next wks | |
End Sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' MACRO to unhide all sheets and display count | |
Sub Unhide_All_Sheets_Count() | |
Dim wks As Worksheet | |
Dim count As Integer | |
count = 0 | |
For Each wks In ActiveWorkbook.Worksheets | |
If wks.Visible <> xlSheetVisible Then | |
wks.Visible = xlSheetVisible | |
count = count + 1 | |
End If | |
Next wks | |
If count > 0 Then | |
MsgBox count & " worksheets have been unhidden.", vbOKOnly, "Unhiding worksheets" | |
Else | |
MsgBox "No hidden worksheets have been found.", vbOKOnly, "Unhiding worksheets" | |
End If | |
End Sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'Unhide worksheets with a specific word in the sheet name | |
Sub Unhide_Sheets_Contain() | |
Dim wks As Worksheet | |
Dim count As Integer | |
count = 0 | |
For Each wks In ActiveWorkbook.Worksheets | |
If (wks.Visible <> xlSheetVisible) And (InStr(wks.Name, "report") > 0) Then | |
wks.Visible = xlSheetVisible | |
count = count + 1 | |
End If | |
Next wks | |
If count > 0 Then | |
MsgBox count & " worksheets have been unhidden.", vbOKOnly, "Unhiding worksheets" | |
Else | |
MsgBox "No hidden worksheets with the specified name have been found.", vbOKOnly, "Unhiding worksheets" | |
End If | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment