right click hide
Try code like the following:
Sub AddMenuItem()
RemoveMenuItem
With Application.CommandBars("Ply").Controls.Add( _
Type:=msoControlButton, temporary:=True)
.Caption = "Hide The Sheet"
.OnAction = "'" & ThisWorkbook.Name & "'!HideTheSheet"
.Tag = "__HIDE_SHEET__"
End With
End Sub
Sub HideTheSheet()
Dim VisCount As Long
Dim WS As Worksheet
For Each WS In ActiveWorkbook.Worksheets
If WS.Visible = xlSheetVisible Then
VisCount = VisCount + 1
End If
Next WS
If VisCount 1 Then
ActiveSheet.Visible = xlSheetHidden
End If
End Sub
Sub RemoveMenuItem()
On Error Resume Next
Application.CommandBars.FindControl(Tag:="__HIDE_S HEET__").Delete
End Sub
"General" wrote in message
...
I would like to add a 'hide sheet' option to the right click menu per tab.
Can you help please?
|