Help with customizing Tab/Sheet names with Add-ins

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:
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:

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top