• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Macro to Unhide Sheets

J G

Member
So I'm just getting my feet wet with macros and am learning that there are about a hundred ways to write the code for the same result. I'm trying to find a macro to unhide all sheets and there are plenty on the web to choose from however none of them seem to work in my workbook.

This is the latest one I'm trying

Code:
Sub UnhideAllSheets()
'Unhide all sheets in workbook.
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Visible = xlSheetVisible
Next ws
End Sub

Why doesn't it work?
 
You should put this code in your "Thisworkbook" instance and run it from there and there should be atleast one sheet unhidden for the macro to work . It works perfectly at my end...
 
Hi J G,


The code you posted above works well in my Excel 2010. I had inserted new module and pasted your code there and run the code, all the hidden sheet becomes visible.

Regards,
 
  • Like
Reactions: J G
Hi,

You might doing something wrong. Pls share your sample workbook so that same can address.
 
Thanks very much for verifying that the code worked. I had protected the workbook and the code could not over come that. Rookie mistake.

Thanks very much.
 
Back
Top