Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default right click hide

I would like to add a 'hide sheet' option to the right click menu per tab.
Can you help please?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
One-click hide or unhide rows & columns Togowa Excel Worksheet Functions 3 August 11th 12 06:45 PM
Hide/Unhide with cell double click bones288 Excel Worksheet Functions 3 January 31st 12 07:47 PM
Hide "Show details" when right click on data field in Pivot Table Anh Tuan Excel Discussion (Misc queries) 0 June 18th 09 07:57 AM
Click on graph bar to execute a double-click in a pivot table cell [email protected] Charts and Charting in Excel 4 August 3rd 05 01:37 AM
Mouse Over Graph, Capture Information on Click(Double Click) Dean Hinson[_3_] Excel Programming 1 December 6th 04 04:49 AM


All times are GMT +1. The time now is 03:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"