我是菜鸟,请教大虾,我有如下图的一个索引表的工作簿
通过如下代码隐藏空工作表不成,提示错误。
Sub YCKB() '隐藏空表
Application.ScreenUpdating = False
ThisWorkbook.Unprotect
Dim Parr
Dim Ccount As Integer
Dim Ix As Integer
Dim Ax As Integer
Dim ash As String
Parr = Array(1, 5)
Ccount = Sheets("索引").Range("C65536").End(xlUp).Row
For Ax = 1 To UBound(Parr)
For Ix = 1 To Ccount
If Sheets("索引").Cells(Ix, Parr(Ax)) <> "√" And Len(Sheets("索引").Cells(Ix, Parr(Ax) + 2)) > 0 And WorksheetFunction.IsNumber(Sheets("索引").Cells(Ix, Parr(Ax) + 2)) = False Then
ash = Sheets("索引").Cells(Ix, Parr(Ax) + 2)
If Sheets(ash).Visible = True Then
Sheets(ash).Visible = False
End If
End If
Next Ix
Next Ax
Application.ScreenUpdating = True
ThisWorkbook.Protect STRUCTURE:=True, Windows:=False
End Sub
提示错误为下标越界。调试指向这里有错误: If Sheets(ash).Visible = True Then。
请大虾指点