Hide All Worksheets Except One

  • Hello

    Im trying to hide/unhide spesific sheets in my workbook.
    The code is in a modul, and i want to start them in the end of a userform (homemaid logg inn) (like hide.start()).

    The probleam is that i get som errors when i run the code.

    As you can see in the code I have a full functional logg inn method, that gives 1 if its correct, and 0 if its not.

    The error i get is thet is: Method "Visible" of Object "Worksheet" failed.

    Hope someone can help me!

  • Re: Hide/Undide Multiple Sheets In VBA Code

    Please read the rules regarding thread titles. Yours has been changed this time.


  • Re: Hide/Undide Multiple Sheets In VBA Code

    If you are running all all sheets except for 1 you will be better to use something like:

    For Each wsLoop In ThisWorkbook.Worksheets
            If wsLoop.Name <> "SheetX" Then wsLoop.Visible = vVisible
        Next wsLoop
  • Re: Hide All Worksheets Except One

    Please let us know how you solved your problem, there could be others with the same problem
    thank you

    "The problem with designing vba code completely foolproof is to underestimate the ingenuity of a complete fool."

  • Re: Hide All Worksheets Except One

    I found out that I had password protected the structur of the workbook.
    When I removed the password, it worked.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!