UMAKEMESIK
Active Member
- Joined
- Oct 3, 2005
- Messages
- 378
We received this code from another Mr.Excel user a while back
and have been using. But now we would like to customize our
tab names but when I changed the tab name beyond the standard
Sheet1, Sheet2,...... I get an error.
Is there a way to modify the code below so that I can customize
the tab name and that name will show up on the drop down list
in the menu bar.
When I customized the tab at the bottom of the wb
I get a debug error on this line:
Thanks in advance for your time.
and have been using. But now we would like to customize our
tab names but when I changed the tab name beyond the standard
Sheet1, Sheet2,...... I get an error.
Is there a way to modify the code below so that I can customize
the tab name and that name will show up on the drop down list
in the menu bar.
When I customized the tab at the bottom of the wb
I get a debug error on this line:
Code:
With Worksheets(.List(.ListIndex))
Thanks in advance for your time.
Code:
Private Sub ResetMenu()
On Error Resume Next
Application.CommandBars("Worksheet Menu Bar").Controls("Sheet selector").Delete
Err.Clear
End Sub
Private Sub MakeCBO()
With Application
.ScreenUpdating = False
Run "ResetMenu"
Dim cboSheetz As CommandBarComboBox, ws As Worksheet
With .CommandBars("Worksheet Menu Bar")
Set cboSheetz = .Controls.Add(Type:=msoControlComboBox, before:=.Controls.Count)
End With
With cboSheetz
.Caption = "SHEET SELECTOR"
.OnAction = "mySheet"
End With
For Each ws In Worksheets
cboSheetz.AddItem ws.Name
Next ws
.ScreenUpdating = True
End With
End Sub
Private Sub mySheet()
Application.ScreenUpdating = False
With CommandBars("Worksheet Menu Bar").Controls("SHEET SELECTOR")
With Worksheets(.List(.ListIndex))
.Visible = xlSheetVisible
.Activate
End With
Dim ws As Worksheet
For Each ws In Worksheets
If ws.Name <> .List(.ListIndex) Then ws.Visible = xlSheetVeryHidden
Next ws
End With
Application.ScreenUpdating = True
End Sub
Last edited: