Hide or Unhide All Worksheets Using Macros in Excel
If you are facing trouble while trying to hide all messy worksheets in your Excel. Then this tutorial will help you to hide all worksheets by using the Macros in your Excel.
Before following the procedure of this tutorial make sure you have enabled the Excel’s Developer Tab.
Purpose of this tutorial: Hide all other worksheets except the active worksheet
Previously on Macros: How to Use Macros in Excel to Highlight the Duplicates?
Here is an example of messy workbooks/sheets;
STEP 1: GO TO DEVELOPER> CODE> VISUAL BASIC> COPY/PASTE THE CODE BELOW > CLOSE THE WINDOW
Copy the Code below;
Dim worksheet As Worksheet
‘Loop through the worksheets
For Each worksheet In ThisWorkbook.Worksheets
‘Hide the sheet if it’s not the active sheet
If worksheet.Name <> ThisWorkbook.ActiveSheet.Name Then
worksheet.Visible = xlSheetHidden
STEP 2: Now first you have to open the sheet that contains data with the help of this procedure: Go to Developer > Code > Macros > Run
Here is your result;