Home Excel Powerpoint Word Outlook Error Codes

VBA Useful Codes

Welcome to the World of VBA
Home > VBAUsefulCodes

Excel Macro to hide all worksheets except activeSheet


Hide all sheets except the active sheet

Sub HideAllWorksheets()
Dim wb As Workbook
Dim fPath As String
fPath = "C:\myfile.xlsx"
Set wb = workbooks.Open(Filename:=fPath)
For Each Sheet In wb.Worksheets
    If Sheet.Name  ActiveSheet.Name Then
        Sheet.Visible = False
    End If
Next
End Sub


Subscribe

Enter your e-mail below and get notified on the latest blog posts.




Tags

VBA Outlook KPI Excel Alt+F11 Dashboards Macros Recording Graphs Automation Developer WaterFall Powerpoint Charts Pivot Tables Forecast Charts


Follow Us