Thursday, November 19, 2009

Excel: Toggle Hide Unhide data sheets

'--------------------------------------------------------------------------------
' Toggle Hide Unhide data sheets
' This macro creates an array of sheet names and upon running this macro
' will hide/unhide sheets
' Note: Atleast one sheet should be visible
'
'--------------------------------------------------------------------------------
Sub ToggleHideUnhideDataSheets()

Application.ScreenUpdating = False

Dim wb As Workbook
Dim ShtNames() As Variant

Set wb = ActiveWorkbook

ShtNames = Array("Sheet1", "Sheet2", "Sheet3", "Sheet4", "Sheet5")

For i = 0 To UBound(ShtNames)
wb.Sheets(ShtNames(i)).Visible = Not wb.Sheets(ShtNames(i)).Visible
Next i

End Sub

2 comments:


  1. With integrity, you have nothing to fear, since you have nothing to hide. With integrity, you will do the right thing, so
    you will have no guilt. See the link below for more info.


    #hide
    www.ufgop.org

    ReplyDelete
  2. The following time I read a weblog, I hope that it doesnt disappoint me as a lot as this one. I mean, I do know it was my option to read, but I actually thought youd have something attention-grabbing to say. All I hear is a bunch of whining about something that you could possibly fix when you werent too busy on the lookout for attention. casino slots

    ReplyDelete