复制下面的代码,粘贴右侧窗口 SubUnhideAllSheets() DimHiddenSheetAsWorksheet ForEachHiddenSheetInActiveWorkbook.Worksheets HiddenSheet.Visible = xlSheetVisible NextHiddenSheet EndSub 如下图: 然后点击运行(或者按F5键),大功告成! 如果你原来的文件不是.xlsm后缀的,在执行完这个操作后,点击保存会出现下面的对话...
For 201 Worksheets Loop HideAll - Time: 0.039 sec (initial setup - sets array, except one Ws in one operation) Loop ShowAll - Time: 0.648 sec (initial setup - unhides all using a loop) View ShowAll - Time: 0.023 sec (consecutive runs - no loop) View HideAll - Time: 0.023 sec (...
Function VisibleSheetsNum() As Long Dim i As Long Dim lngNum As Long lngNum = 0 '遍历工作表 For i = 1 To Sheets.Count '如果工作表可见则统计 If Sheets(i).Visible =xlSheetVisible Then lngNum = lngNum +1 End If Next VisibleShe...
Sub UnhideAllWorksheet() Dim ws As Worksheet For Each ws In ActiveWorkbook.Worksheets ws.Visible = xlSheetVisible Next ws End Sub 如果您想取消隐藏使用以前的代码隐藏的所有工作表,那么这里是该代码。 36. 删除除活动工作表之外的所有工作表 Sub DeleteWorksheets() Dim ws As Worksheet For Each ws In ...
下面的代码取消隐藏工作簿中的所有工作表: Sub UnhideAllWorksheets() Dim ws As Worksheet For Each ws In Worksheets ws.Visible =xlSheetVisible Next ws End Sub 本文属原创文章,转载请联系我(***)或者注明出处。 欢迎在下面留言,完善本文内容,让更多的人学到更完美的知识。©2022 Baidu |由 百度...
'单引号后面是注释,这段代码显示所有隐藏的工作表Sub UnhideAllWoksheets()Dim ws As WorksheetForEach ws In ActiveWorkbook.Worksheetsws.Visible = xlSheetVisibleNext wsEndSub 2、下面这段代码隐藏除活动工作表以外的所有工作表。'隐藏除活动工作表以外的所有工作表Sub HideAllExceptActiveSheet()Dim ws As ...
'单引号后面是注释,这段代码显示所有隐藏的工作表SubUnhideAllWoksheets()DimwsAsWorksheetForEachwsInActiveWorkbook.Worksheets ws.Visible = xlSheetVisibleNextwsEndSub 2、下面这段代码隐藏除活动工作表以外的所有工作表。 '隐藏除活动工作表以外的所有工作表SubHideAllExceptActiveSheet()DimwsAsWorksheetForEachwsInTh...
Sub UnhideAllWoksheets() Dim ws As Worksheet For Each ws In ActiveWorkbook.Worksheets ws.Visible = xlSheetVisible Next ws End Sub 2.隐藏除了活动工作表外的所有工作表 如果你做的报表,希望隐藏除了报表工作表以外的所有工作表,则可以用一下代码来实现: Sub HideAllExcetActiveSheet() Dim ws As Worksheet...
下面的代码,可以让你一次显示所有的工作表Sub UnhideAllWoksheets() Dim ws As Worksheet For Each ws In ActiveWorkbook.Worksheets ws.Visible = xlSheetVisible Next ws End Sub 2.隐藏除了活动工作表外的所有工作表 如果你做的报表,希望隐藏除了报表工作表以外的所有工作表,则可以用一下代码来实现:Sub HideAll...
Sheets(Sheets_Arr(i)).Visible = True Next i End Sub After running the code, you can see all those hidden sheets have appeared. Example 4 – Hide and Unhide Sheets by Tab Color We changed the tab color of the “Middle School” and “College” sheets to blue. We want to hide and u...