excel中编个vba代码,可以实现按钮跳转工作表,但是只想要隐藏的工作表,比如:在sheet1中添加一个按钮
Sub abc()
Sheet2.Visible = xlSheetVisible
Sheet2.Activate
Sheet1.Visible = xlSheetHidden
End Sub
Sub abcd()
Sheet1.Visible = xlSheetVisible
Sheet1.Activate
Sheet2.Visible = xlSheetHidden
End Sub
Sub 激活隐藏()
Dim St As Worksheet
Dim Sht As Worksheet
Dim arr, i%
Set St = Sheets("目录")
arr = St.Range("B2:C6")
For i = 2 To UBound(arr)
Set Sht = Sheets(arr(i, 1))
If arr(i, 2) = "是" Then
Sht.Visible = xlSheetVisible
ElseIf arr(i, 2) = "否" Then
Sht.Visible = xlSheetHidden
End If
Next
End Sub