可以做一个自动运行宏,在工作簿打开时自动执行,执行的结果是只显示表1与表2,隐藏其他表。
Private
Sub
Workbook_Open()
For
i
=
1
To
Worksheets.Count
If
Sheets(i).Name
<>
"Sheet1"
And
Sheets(i).Name
<>
"Sheet2"
Then
Sheets(i).Visible
=
False
End
If
Next
End
Sub
按ALT+F11,打开代码窗,左边
工程管理器
内,双击
thisworkbook,将下面的代码复制入其中,保存,关闭,重新打开就好了(提前设置好
启用宏)
-----------------
Private
Sub
Workbook_Open()
Dim
sh
As
Worksheet,
arr
arr
=
Array("Sheet1",
"Sheet2")
Worksheets(arr(0)).Visible
=
True
Worksheets(arr(1)).Visible
=
True
For
Each
sh
In
Worksheets
If
sh.Name
<>
arr(0)
And
sh.Name
<>
arr(1)
Then
sh.Visible
=
False
End
If
Next
End
Sub
public sub 隐藏()
range("s100").offset(1, 0).resize(rows.count - range("s100").row, 1).entirerow.hidden = true
range("s100").offset(0, 1).resize(1, columns.count - range("s100").column).entirecolumn.hidden = true
end sub
来个最简单的
Private
Sub
Workbook_Open()
For
i
=
3
To
Worksheets.Count
Sheets(i).Visible
=
False
Next
End
Sub