Remove the Selected Tab from an Excel VBA TabStrip
Question details
Remove the currently selected tab from an ActiveX TabStrip with VBA and optionally activate another tab.

- Product
- Microsoft Excel VBA ActiveX TabStrip
- Device & OS
- not provided
- Scenario
- A workbook uses a TabStrip control, and the user wants a macro to delete its selected tab.
- Observed behavior
- The selected tab is removed, and another tab can be activated if any tabs remain.
Confirm that the control is an ActiveX TabStrip named TabStrip1 on the active worksheet. Check that your Excel installation permits macros and ActiveX controls under its security settings.
Remove the selected worksheet TabStrip tab with VBA
Use the selected tab's index with Tabs.Remove, then optionally select a remaining tab.
In Excel, open the workbook and press Alt+F11. Select Insert > Module to add a standard VBA module.
Paste this code into the module: Sub RemoveSelectedTab() Dim Ts As Object Set Ts = ActiveSheet.OLEObjects("TabStrip1").Object If Ts.Tabs.Count > 0 Then Ts.Tabs.Remove Ts.SelectedItem.Index If Ts.Tabs.Count > 0 Then Ts.Value = 0 End If End Sub
Return to Excel, select the worksheet containing TabStrip1, and select the tab to remove. Press Alt+F8, choose RemoveSelectedTab, and click Run.

Work with Excel spreadsheets in WPS Office
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and support for common Excel formats, making it easy to move everyday spreadsheet work. It does not fix Excel ActiveX or VBA issues, so verify any macro-dependent workbook before migrating.

Frequently Asked Questions
How do I remove the selected tab without activating another one explicitly?
Call Ts.Tabs.Remove Ts.SelectedItem.Index and omit the line that assigns Ts.Value. Check Ts.Tabs.Count first so the removal runs only when a tab exists.
How do I add a tab to the TabStrip?
After obtaining the control as Ts, use Ts.Tabs.Add in your VBA procedure to add a tab.
Can I use this approach with a UserForm TabStrip?
Yes. In code within the UserForm, refer to the control with Me.TabStrip1 instead of ActiveSheet.OLEObjects("TabStrip1").Object, then use the same Tabs.Remove call.
Will deleting a TabStrip tab hide its associated controls?
No. A TabStrip does not automatically manage other controls. Add VBA that changes those controls' Visible properties when the selected tab changes or is removed.




