Sub topic 14
Adding, renaming, moving, and hiding worksheets
This chapter assumes you can open a blank workbook, you know that a workbook holds worksheets, and you can read a cell address such as B4. It covers the sheet tab bar at the bottom of the window. You use it to add, name, order, color, hide, copy, and delete worksheets.
What sheet tabs do
Each worksheet in a workbook has a tab at the bottom of the window. The active sheet's tab looks highlighted. Everything you do to a sheet as a whole starts from its tab, usually with a right-click.
Sheet-level actions differ from cell-level actions. Typing, formatting, and formulas change cells. Insert, Rename, Move, Hide, and Delete change the worksheet itself.
| Action | Right-click menu item | Keyboard route |
|---|---|---|
| Add a sheet | Insert... | Shift+F11 |
| Rename | Rename | Double-click the tab, or Alt, H, O, R |
| Move or copy | Move or Copy... | Alt, H, O, M |
| Tab color | Tab Color | Alt, H, O, T |
| Hide | Hide | Alt, H, O, U, S |
| Delete | Delete | Alt, H, D, S |
The Alt sequences are the key tips from the Home tab's Format and Cells groups. Press them one key at a time, not together.
Adding worksheets
There are three common ways to add a sheet.
- Click the plus button to the right of the last tab. The new sheet goes after the last tab. The right-click Insert... dialog is different, as step 3 explains.
- Press Shift+F11. The new sheet goes in front of the active sheet.
- Right-click a tab and choose Insert..., then choose Worksheet. The new sheet goes in front of the tab you clicked.
New sheets get default names such as Sheet2 and Sheet3. A new workbook may start with one sheet or more, depending on your Excel settings. The count is set in File, Options, General, under "Include this many sheets".
Renaming worksheets
Good names make formulas and navigation easier to read. Double-click the tab, type the new name, and press Enter.
Sheet names follow these rules:
- The name can be 1 to 31 characters long.
- The characters
\ / ? * [ ] :are not allowed. - The name cannot start or end with an apostrophe.
- Two sheets in one workbook cannot share a name. The comparison ignores upper and lower case, so
SalesandSALESclash. - "History" is reserved by Excel and cannot be used.
Names with spaces still work. A formula that refers to them needs single quotes, as in ='Q1 Sales'!B4. A name without spaces, such as Q1_Sales, needs no quotes. That makes formulas shorter and less error-prone.
Renaming a sheet updates formulas that refer to it. A formula that pointed to Sheet2!A1 changes to Data!A1 when you rename Sheet2 to Data. The exception is text-based references. A formula built with INDIRECT("Sheet2!A1") stores the name inside a string. Excel does not rewrite it, and it breaks after the rename.
=INDIRECT("'"&A1&"'!B4")If A1 holds the sheet name, this formula reads cell B4 on that sheet. Renaming the sheet means you must also change the text in A1.
Moving and copying worksheets
To reorder tabs, drag a tab left or right. A small black triangle shows where the sheet will land when you release the mouse button. Hold Ctrl while dragging to copy the sheet instead of moving it. A copy gets the original's name followed by a number in parentheses, such as Jan (2).
For more control, right-click the tab and choose Move or Copy.... The dialog gives you three options:
- To book lists the current workbook, any other open workbook, and "(new book)". Choose another workbook to send the sheet there.
- Before sheet sets the position in the destination.
- Create a copy turns the move into a copy.
Tab order matters in more than appearance. A 3D reference such as =SUM(Jan:Mar!B2) adds B2 on every sheet between Jan and Mar, in tab order. If you drag a sheet in between those two tabs, it joins the calculation. If you drag one out, it leaves.
Moving sheets between workbooks
When you move or copy a sheet to another workbook, formulas that refer to cells in other sheets can keep pointing to the source workbook. Excel then stores an external reference with the file name in square brackets. Check such formulas afterward. The Data tab's Edit Links command lists them.
Moving a sheet out of its workbook also removes it from any 3D reference range that included it.
Coloring tabs
Right-click the tab, choose Tab Color, and pick a color. Use color to group related sheets, for example blue for inputs, green for calculations, and gray for reference data. The color shows as a solid bar when the tab is not selected. When the tab is selected, it shows as a lighter gradient.
Hiding and unhiding worksheets
Right-click a tab and choose Hide. The sheet disappears from the tab bar but still exists. Formulas that refer to it keep working. Hiding is a way to reduce clutter, not a way to secure data.
To show a hidden sheet, right-click any visible tab and choose Unhide.... A list of hidden sheets appears. Pick one and click OK. In older Excel versions you can unhide only one sheet at a time. Newer versions let you select several with Ctrl or Shift.
Two limits apply:
- You cannot hide every sheet. A workbook must keep at least one visible sheet.
- Unhide... is grayed out if the workbook has no hidden sheets, or if the workbook structure is protected.
Very hidden sheets
Excel also has a third state called "very hidden". These sheets do not appear in the Unhide... list. You can set this state only in the Visual Basic Editor, by changing a sheet's Visible property to xlSheetVeryHidden. It stops casual users from finding the sheet, but it is not security. Anyone who opens the Visual Basic Editor can change it back.
Sub MakeSheetVeryHidden()
ThisWorkbook.Worksheets("Data").Visible = xlSheetVeryHidden
End Sub
Sub MakeSheetVisible()
ThisWorkbook.Worksheets("Data").Visible = xlSheetVisible
End SubUse the file only if it is saved as a macro-enabled workbook (.xlsm) when you keep this code in it. For data that must stay private, use encryption in the Backstage view, not hiding.
Deleting worksheets
Right-click the tab and choose Delete. If the sheet contains data, Excel asks you to confirm. If it is empty, Excel deletes it without asking.
Deleting a sheet cannot be undone with Ctrl+Z. Save a copy of the workbook first if you are not sure. Formulas that referred to the deleted sheet show #REF!. Deleting a sheet also shrinks any 3D range that used it as an endpoint. If you delete Mar from Jan:Mar, the range then ends at the sheet that was next to it.
Selecting several tabs
Click one tab, then Ctrl+click to add individual tabs, or Shift+click to select a run. Right-click and choose Select All Sheets to select every tab. Several sheets selected at once are called a group, and the title bar shows [Group]. In group mode, an edit on one sheet is repeated on all the selected sheets. A later chapter covers this. For now, remember to click a single unselected tab to leave group mode before you type anything.
Selecting several tabs also lets you apply sheet-level actions to all of them in one step. You can hide, delete, or color several sheets at once.
Common errors
- A sheet cannot be renamed. The name may be a duplicate, too long, or contain a forbidden character. The workbook structure may also be protected.
- Unhide... is grayed out. No sheets are hidden, or the structure is protected.
- A copied sheet shows odd names. A copy gets a numbered name. Rename it right away, so formulas stay readable.
- A total changed after a sheet was moved. The sheet moved into or out of a 3D range.
- An edit appears on many sheets. You were in group mode. Click a single tab to leave it.
Exercise
A workbook has tabs Jan, Feb, Mar, and Summary, in that order. Summary holds =SUM(Jan:Mar!B2). You drag Summary between Jan and Feb, then drag a new sheet named Notes between Feb and Mar. Which sheets does the formula now add, and what happens if you then hide Feb?
Show answer
The formula was written on Summary and refers to the range Jan:Mar. After the moves the tab order is Jan, Summary, Feb, Notes, Mar. The 3D range includes every sheet from Jan to Mar in that order, so it adds B2 on Summary, Feb, and Notes as well. That puts Summary's own cell in the sum, which creates a circular reference if the formula is in B2. Hiding Feb changes nothing, because hidden sheets stay in the range and keep working in formulas.
Exercise
You want to give a colleague a workbook but keep a sheet named Rates out of sight so it does not clutter the view. Which state do you use, and does it keep the rates private?
Show answer
Use Hide from the right-click menu. It removes the sheet from the tab bar, and the colleague can restore it with Unhide.... It does not keep the rates private. Very hidden also fails as protection, because anyone can reveal it in the Visual Basic Editor. For privacy, encrypt the file or remove the sheet.