Sub HideWorksheet() Dim ws As Worksheet For Each ws In ThisWorkbook.Worksheets If ws.Name <> ThisWorkbook.ActiveSheet.Name Then ws.Visible = xlSheetHidden End If Next ws End Sub
Macro code for Hide all Hide Inactive Worksheet in excel. Now, let’s say if you want to hide all the worksheets in your workbook other than the active worksheet. This macro code will do this for you.