报错 Unable to set the visible property of the worksheet class
我打开worksheet前会先跑这段代码
Private Sub Workbook_Open()
'Application.ScreenUpdating = False
Application.EnableEvents = False
Worksheets("Main").Protect Password:="123456", DrawingObjects:=True, Contents:=True, Scenarios:=True, userInterfaceOnly:=True
Worksheets("Report").Protect Password:="123456", DrawingObjects:=True, Contents:=True, Scenarios:=True, userInterfaceOnly:=True
'Worksheets("Report").Visible = False
Worksheets("Main").Select
'Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub

解决方案 »

  1.   

    Worksheets("Report").Visible = False 
    这句没错呀,你确认你打开的工作簿中,有名称为 “Report” 的工作表吗?
    并且,除了这张表外,至少还有1个别的工作表可见。
      

  2.   

    应该有吧  图上project里都有sheet2(Report)
    我一共有6张表,只有两个表[sheet2 Report][sheet4 Circuit Report]的Visible属性是 -1 xlsheetHidden
    但是,所有表的Visible选项被改变了,都会报错Unable to set the visible property of the worksheet class
      

  3.   

    原来既可以保护工作薄, 又可以保护工作薄里的sheet, 如果只unprotected sheet,工作薄是protected的. 还是不能修改工作簿结构