vba设置超链接隐藏工作表

客户编号中设置了VBA代码,点击链接后显示客户信息,返回目录后自动隐藏。但是超链接无法编辑,点击确定后,显示下标越界,改怎么修改超链接或者VBA代码。
目录表的代码:
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink) Sheets(Target.Name).Visible = xlSheetVisible Sheet1.Visible = xlSheetVeryHiddenEnd Subsheet2代码:
Private Sub CommandButton1_Click() Sheet1.Visible = xlSheetVisible Sheet2.Visible = xlSheetVeryHiddenEnd Subworkbook代码:
Private Sub Workbook_SheetActivate(ByVal sh As Object) With Sheets("目录表") m = 0 For i = 1 To Sheets.Count 'SubAddress:=Sheets(i).Range("b1").Address, If Sheets(i).Name <> "目录表" Then m = m + 1 End If Next i End WithEnd Sub模块1代码:
Sub Macro3() With Sheets("目录表") m = 0 For i = 1 To Sheets.Count 'SubAddress:=Sheets(i).Range("b1").Address, If Sheets(i).Name <> "目录表" Then m = m + 1
End If Next i End WithEnd SubSub auto_open() Dim i As Integer For i = 1 To Sheets.Count If i = 1 Then Sheets(i).Visible = xlSheetVisible Else Sheets(i).Visible = xlSheetVeryHidden End If Next iEnd Sub

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
    c = Left(Target.Name, InStr(Target.Name, "!") - 1)
    Sheets(c).Visible = xlSheetVisible
    Sheet1.Visible = xlSheetVeryHidden
End Sub
温馨提示:内容为网友见解,仅供参考
第1个回答  2015-09-17
把附件发上来,才好调试你的问题。
粗略看了一下,如果是为了简单的工作表之间的跳转链接,那么代码不需要那么复杂。其实很简单。
相似回答