VBA to hide sheets

karthik_kaliappan

Board Regular
Joined
Jun 8, 2007
Messages
76
Hi,

Sub Hideall()

Sheets(Array("Sheet2", "Sheet3")).Select
Sheets("Sheet1").Activate
ActiveWindow.SelectedSheets.Visible = False
End Sub

i wrote a simple macro to hide couple sheets leaving the first sheet, but i was looking for a macro which would probably hide all the sheets leaving the fisrt one, but was kind off confused what coding should i give. Could any one help me with this please?

Rgds,
karthik.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Code:
Sub HideAll()
Dim ws As Worksheet
    For Each ws In ActiveWorkbook.Worksheets
        If ws.Name <> "Sheet1" Then
            ws.Visible = False
        End If
    Next ws
End Sub
This code hides all but "Sheet1".
 
Upvote 0
Hi guys
i'm new to Mr Excel, please do not mind if im doing something wrong.

i'm currently working on a financial model, whereby i will have my "income statement" sheet, balance sheet" sheet and the "cash flow" sheet. each of these sheets will have their respective sets of assumption sheets.

basically what i want is that i have a major sheet (Summary Sheet) which shows 3 buttons and each one will open the main sheet and its respective assumption sheets. also, in each of the income statement, balance sheet and cash flow sheets, there should be a macro to enable me to close everything and get back to the main sheet (summary sheet)

great if you guys could help me write the code!

thanks!
 
Upvote 0

Forum statistics

Threads
1,214,622
Messages
6,120,585
Members
448,972
Latest member
Shantanu2024

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top