How to select all sheets except one in Excel?
We can apply the Select All Sheets feature to select all sheet tabs of a workbook, but, do you have any ideas to select all sheets except the specific one in Excel?
Select all sheet tabs except specific one with VBA code
Select all sheet tabs except specific one with VBA code
To select all tabs except specific one, the following VBA code can help you, please do as this:
1. Hold down the ALT + F11 keys, then it opens the Microsoft Visual Basic for Applications window.
2. Click Insert > Module, and paste the following code in the Module Window.
VBA code: Select all sheets except one:
Sub selectallbutone()
'Updateby Extendoffice
Dim x As Long
Sheet1.Select
For x = 2 To ThisWorkbook.Sheets.Count
If Sheets(x).Name <> "Sheet5" Then Sheets(x).Select Replace:=False
Next x
End Sub
Note: In the above code, Sheet5 is the sheet name that you want to exclude when selecting all sheets, please change it to your need.
3. And then press F5 key to run this code, and all sheet tabs have been selected except the specific one, see screenshot:
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!