[Fixed!] Unable to Set the Visible Property of the Worksheet Class

If you are looking for some special tricks to solve the problem of “unable to set the visible property of the worksheet class”, you’ve come to the right place. In Microsoft Excel, there are numerous ways to fix this problem. This article will discuss three methods to resolve the problem. Let’s follow the complete guide to learn all of this.


Download Practice Workbook

Download this practice workbook to exercise while you are reading this article. It contains all the datasets and methods in different spreadsheets for a clear understanding.


3 Possible Solutions for “Unable to Set the Visible Property of the Worksheet Class” Error

In the following section, we will use three effective and tricky solutions to solve the problem of “unable to set the visible property of the worksheet class”. Firstly, we will try to solve the problem by unprotecting the worksheet from the review tab in MS Excel. We will use the VBA code to solve the problem in the second and third solutions. This section provides extensive details on these solutions. You should learn and apply these to improve your thinking capability and Excel knowledge. We use the Microsoft Office 365 version here, but you can utilize any other version according to your preference. There are times when trying to change the worksheet’s visible property in Microsoft Excel results in an error message reading “unable to set the visible property of the worksheet class”. The problem will look like this.

Unable to Set the Visible Property of the Worksheet Class

Now, we are going to demonstrate how we can solve the problem.


Solution 1: Unprotect Your Worksheet from Review Tab

The visible property of a worksheet class can sometimes be unset in Microsoft Excel due to an error message reading “unable to set the visible property of the worksheet class.” You will get an error message if you try to change the visible property of Sheet3 after opening the VBA window, as shown below.

Unprotect Your Worksheet to solve "Unable to Set the Visible Property of the Worksheet Class"

The fact that the workbook or worksheets are protected is the primary cause of this happening. Visibility can be set only after the workbook and worksheets have been unprotected. To solve this problem, first of all, you have to open Sheet3 and go to the Review tab and select Unprotect Sheet.

Unprotect Your Worksheet

Next, when the Unprotect Sheet window appears, type the password and click on OK.

Now, if you try to change the visible property of Sheet3 after opening the VBA window, you will not receive an error message.

select visible option

Read More: [Fixed!] Excel Sheet Not Visible When Opened (6 Solutions)


Solution 2: Close Other Workbooks While Running Macro

Now, if you are running macros while opening multiple workbooks, VBA won’t find the sheet references. For that reason, you have to mention the workbook name. Or, you can run the particular macro keeping other workbooks closed. If you want to solve the problem of “unable to set the visible property of the worksheet class”, you need to use the help of VBA. Microsoft Visual Basic for Applications (VBA) is Microsoft’s Event Driven Programming Language. To use this feature you first need to have the Developer tab showing on your ribbon. Click here to see how you can show the Developer tab on your ribbon. Once you have that, follow these detailed steps to solve the problem of “unable to set the visible property of the worksheet class”,

📌 Steps:

  • VBA has its own separate window to work with. You have to insert the code in this window too. To open the VBA window, go to the Developers tab on your ribbon. Then select Visual Basic from the Code group.

close other workbooks during running macro to solve "Unable to Set the Visible Property of the Worksheet Class"

  • VBA modules hold the code in the Visual Basic Editor. It has a .bcf file extension. We can create or edit one easily through the VBA editor window. To insert a module for the code, go to the Insert tab on the VBA editor. Then click on Module from the drop-down.

insert module

  • As a result, a new module will be created.
  • Now select, the module if it isn’t already selected. Then write down the following code in it. Make sure other workbooks are closed before running the following macro.
Sub solved()
    Dim Msheet As Excel.Worksheet
    For Each Msheet In Worksheets
        Msheet.Visible = xlSheetVeryHidden
    Next Msheet
End Sub
  • Next, save the code.
  • Lastly, you have to click on Run to run the macro.

Now, if you try to change the visible property of any sheet after opening the VBA window, you will not receive an error message.  This is how you will be able to solve the problem.

Read More: How to Unhide Multiple Sheets in Excel (4 Ways)


Solution 3: Unprotect and Re-Protect Your Worksheet

Now, we will show another VBA code to solve the problem. If you want to solve the problem of “unable to set the visible property of the worksheet class”, you need to use the help of following the VBA code. You have to follow these detailed steps to solve the problem of “unable to set the visible property of the worksheet class”,

📌 Steps:

  • VBA has its own separate window to work with. You have to insert the code in this window too. To open the VBA window, go to the Developers tab on your ribbon. Then select Visual Basic from the Code group.

Unprotect and re-protect Worksheet to solve "Unable to Set the Visible Property of the Worksheet Class"

  • VBA modules hold the code in the Visual Basic Editor. It has a .bcf file extension. We can create or edit one easily through the VBA editor window. To insert a module for the code, go to the Insert tab on the VBA editor. Then click on Module from the drop-down.

  • As a result, a new module will be created.
  • Now select, the module if it isn’t already selected. Then, write down the following code in it.
Private Sub Workbooks_Opening()
    Dim wss As Worksheet
    ActiveWorkbook.Unprotect "1055"
    ActiveWorkbook.Worksheets("Split1").Visible = True
    ActiveWorkbook.Worksheets("Split2").Visible = False
    For Each wss In ActiveWorkbook.Worksheets
        If Not wss.Name = "Split1" Then wss.Visible = xlSheetVeryHidden
    Next wss
    With ActiveWorkbook.Worksheets("Split1")
        .Visible = True
        .Activate
    End With
    frmLogin.Show
    bBkIsClose = False
    ActiveWorkbook.Protect "1055", True, False
End Sub
  • Next, save the code.
  • Lastly, you have to click on Run to run the macro.

run macro

Now, if you try to change the visible property of any sheet after opening the VBA window, you will not receive an error message.  This is how you will be able to solve the problem.

Read More: How to Unhide Very Hidden Sheets in Excel (2 Effective Methods)


Conclusion

That’s the end of today’s session. I strongly believe that from now, you may solve the problem of “unable to set the visible property of the worksheet class”. If you have any queries or recommendations, please share them in the comments section below.

Don’t forget to check our website ExcelDemy.com for various Excel-related problems and solutions. Keep learning new methods and keep growing!


Related Articles

Saquib

Saquib

Welcome to my Profile. I am working on and researching Microsoft Excel right now, and I will be posting articles about it here. I received a B.Sc. in Naval Architecture and Marine Engineering from the Bangladesh University of Engineering and Technology (BUET). Having studied naval architecture, I have a strong interest in research and development. Always try to learn from different sources and come up with creative solutions.

We will be happy to hear your thoughts

Leave a reply

ExcelDemy
Logo