分享

隐藏和显示工作表标签代码

 依雪茗香 2012-07-07
隐藏代码:
Private Sub Worksheet_Activate()
        Dim sht As Worksheet
        For Each sht In Worksheets
               If sht.Name <> Sheets(1).Name Then sht.Visible = xlSheetVeryHidden
        Next sht
End Sub
 
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
             On Error Resume Next
             Dim shtname As String
             shtname = Target.Hyperlinks(1).SubAddress
             shtname = Mid(shtname, 1, InStr(shtname, "!") - 1)
              shtname = Replace(shtname, "'", "")
             
              Sheets(shtname).Visible = xlSheetVisible
             Sheets(shtname).Select
End Sub
显示代码:
Sub ShowAllMySheets()
   MsgBox "使当前工作簿中的所有工作表都显示(即将隐藏的工作表也显示)"
   Dim ws As Worksheet
   For Each ws In Sheets
    ws.Visible = True
   Next ws
  End Sub

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多