Excel Macro or VBA to Hide or unhide all hidden sheets in an Excel workbook

We hide sheets for many reasons, to keep people out of them, when we have En Number of Sheets to hide or unhide every time you have to right click and click hide or unhide it will obviously suck you whole time, using Excel VBA code to do this job really awesome, in a single click u can finish this job.



To unhide sheets, click any sheet tab and choose Unhide from the context menu. Then, select the sheet you want to unhide from the list and click OK. Although easy, unhiding sheets in this manner is tedious if there happens to be several of them.
Lets see i have given few Example to finish this job very Easy.
Check this Below code.
Sub UnhideAllSheets()
'Unhide all sheets in workbook.
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Visible = xlSheetHidden
Next ws
End Sub




Place a command button and Insert above code and click.
Out put.

See Now Only one sheet left.





Same Way If you want to Unhide. use this below code.
Option Explicit
Sub UnhideAllSheets()
Unhide all sheets in workbook.
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Visible = xlSheetVisible

Next ws
End Sub

Note : Like most macros, this one has limited appeal. If you have only a few hidden sheets and you seldom need to unhide them, it's just as easy to manually unhide them. If, on the other hand, this is a frequent task, you'll probably find this one useful.

Do you like this page..?? Please give your Email id and subscribe for Daily News letter.
Excel Macro or VBA to Hide or unhide all hidden sheets in an Excel workbook Excel Macro or VBA to Hide or unhide all hidden sheets in an Excel workbook Reviewed by Unknown on 02:08 Rating: 5

No comments:

Powered by Blogger.