Ads by Google

Saturday, March 21, 2009

Hide all worksheets except Activeworksheet

Sometimes back I posted how to Unhide all the worksheets.
Here is the code to Hide all the sheets except the one which is Active...
--------------------------------------------------------
Sub Hide()
'Hide all sheets macro by Saalim
Dim wkst As Worksheet
Dim sht1 As Stringsht1 = ActiveSheet.Name
For Each wkst In Worksheets
wkst.Activate
If ActiveSheet.Name <> sht1 Then
wkst.Visible = False
End If
Next wkst
End Sub
-------------------------------------------------