To close the active Excel workbook in Microsoft Excel for Microsoft 365 on Windows, press Ctrl+W or Ctrl+F4. On a Mac, press Command+W. If you have unsaved changes, respond to the save prompt before the workbook closes. These shortcuts close the workbook window; they do not usually quit Excel itself.
What You’ll Need
- An open workbook in the Excel desktop app. The workbook should be the active window when you use the shortcut.
- A keyboard. Use the Windows or Mac shortcut that matches your computer; Excel for the web behaves differently, as explained below.
- If you have made changes you want to keep, a moment to save them or confirm the save prompt.
Step-by-Step
- Make the workbook you want to close active. Click somewhere inside its window, or use Alt+Tab on Windows to switch to it. If you have several workbooks open, check the title bar so you do not close the wrong one. On a Mac, use Command+Tab to switch apps, then select the workbook window in Excel if needed.
- Press Ctrl+W on Windows. Hold down Ctrl, tap W once, and release the keys. Excel closes the active workbook window if it can do so. You can also use Ctrl+F4 for the same basic purpose: closing the active workbook window rather than exiting Excel.
- Use Command+W on a Mac. With the workbook active in Excel for Mac, press Command+W. This closes the current workbook window. It is not the same as Command+Q, which quits the Excel app.
- Check whether Excel asks you to save. If the workbook has changes that are not saved, Excel displays a confirmation prompt. Choose Save to keep the changes, Don’t Save to discard changes made since the last save, or Cancel to return to the workbook without closing it. The exact wording or layout can vary slightly by Excel version.
- Complete any save step. If you select Save, Excel may ask you to choose a location, name the file, or confirm a format. Finish those prompts and wait for the save to complete. If the workbook is stored in OneDrive or SharePoint, check the save or sync status before closing if you need to be certain the latest edits have uploaded.
- Confirm the workbook window has closed. Excel may show another open workbook, a start screen, or a blank app window. That does not necessarily mean the shortcut failed: it can mean the selected workbook closed while Excel stayed open. If you have multiple windows for the same workbook, another window may still display it.
- Close more workbooks one at a time if needed. Select the next workbook and repeat the shortcut. Handle each save prompt separately. This makes it easier to keep track of which files have changes and reduces the chance of discarding work from the wrong workbook.
- Quit Excel only if that is your intention. On Windows, Alt+F4 closes the Excel application when Excel is active. On a Mac, use Command+Q to quit Excel. These are app-level commands, not the usual shortcut for closing just one workbook. If other workbooks have unsaved edits, Excel may ask about those too.
For Excel for the web, do not rely on Ctrl+W to close a workbook: in most browsers, that shortcut closes the browser tab or window. Close the tab using the browser’s close control when you are ready to leave, and check that the workbook has finished saving first. Excel for the web generally saves supported changes automatically, but a visible saving indicator or a connection problem can affect when edits are synced.
Common Mistakes
- Using Alt+F4 when you only want to close a workbook. Alt+F4 is the Windows command for closing the active app window, so it can exit Excel when the last workbook window is open. Prefer Ctrl+W or Ctrl+F4 when you want to close the current workbook and keep working in Excel.
- Confusing a close prompt with an error. A save confirmation is normal when the workbook has unsaved edits. Choose Save, Don’t Save, or Cancel based on what you want; Cancel leaves the workbook open.
- Choosing Don’t Save without checking what will be lost. This discards changes since the last saved version. If unsure, choose Cancel, save a copy or save the current workbook, then close it.
- Pressing the shortcut while another app is active. Keyboard shortcuts apply to the active app. Click the workbook first, then press the Excel shortcut.
- Assuming the workbook is closed because its window disappeared. Other workbook windows may still be open, including a second view of the same file. Check the remaining Excel windows before quitting or reopening a file.
- Using a desktop shortcut in a browser. In Excel for the web, Ctrl+W usually affects the browser tab. Use the tab’s close button instead and confirm that editing has synced.
Tips
- Remember the distinction: Ctrl+W closes a workbook window in Excel for Windows; Alt+F4 closes the app window. On Mac, Command+W closes a window and Command+Q quits the app.
- Save before closing when the work matters. Press Ctrl+S on Windows or Command+S on Mac, wait for the save to finish, and then use the close shortcut. You may still see a prompt if another change occurs after saving.
- Use the mouse if you are uncertain. The workbook window’s close button can close that window, while the application’s controls can behave differently depending on the operating system and window arrangement. Read any prompt before confirming.
- Check the workbook name before closing. This is especially useful when several similarly named files are open. Save prompts usually identify the file, giving you another chance to verify that you are acting on the intended workbook.
- Keep a recoverable copy before risky changes. If you are about to discard edits or replace a file, save a separate copy first. Excel’s AutoRecover can help after some unexpected interruptions, but it is not a substitute for saving important work.
- Learn the shortcut that fits your setup. If you switch between Windows and Mac, remember that the modifier key changes: Ctrl on Windows becomes Command on Mac for this close-window action.
Troubleshooting
- Nothing happens when you press Ctrl+W. Click inside the workbook and try again. Make sure you are using the desktop app, not a browser tab, and that a dialog box is not waiting for a response. If a cell is being edited, press Esc or Enter to finish or cancel cell editing, then try the shortcut.
- The browser closes instead of the workbook. You are likely using Excel for the web. Ctrl+W is handled by the browser, not as a reliable workbook-close command. Check the save indicator, then close the browser tab with its close button. Reopen the file from its OneDrive or SharePoint location if you need to continue later.
- Excel asks about saving, but you do not know what to choose. Choose Cancel to keep the workbook open while you inspect it. Save if you want to keep the current edits. Choose Don’t Save only if you are sure you want to discard changes made since the last saved version. If you want to preserve the original and the edits separately, use Save As to create a copy before closing.
- The workbook seems to stay open after the shortcut. Another window for the same workbook may remain open, or Excel may have switched to another workbook. Look at the open Excel windows and their title bars. Close the remaining window only if you intend to do so, and handle any save prompts that appear.
- The shortcut appears to quit Excel. Check whether you pressed Alt+F4 on Windows or Command+Q on Mac; those quit commands are different from Ctrl+W or Command+W. Reopen Excel and the workbook if needed. If the file was not saved, check Excel’s Document Recovery pane or available AutoRecover files, but do not assume every unsaved change can be restored.
- The save or close prompt will not respond. Allow time for a large workbook or a network location to finish saving. If Excel is frozen, wait briefly before trying other actions, since force-quitting can risk losing unsaved edits. If you must restart the app, reopen Excel afterward and review any recovery options before continuing.
Frequently Asked Questions
What is the shortcut to close an Excel file on Windows?
In the Excel desktop app, press Ctrl+W or Ctrl+F4 to close the active workbook window. Save or respond to the confirmation prompt if one appears.
What is the shortcut to close an Excel file on a Mac?
Press Command+W while the workbook is active in Excel for Mac. Command+Q quits Excel instead of just closing the current workbook window.
Will Ctrl+W save my Excel file automatically?
No. If there are unsaved changes, Excel normally asks what you want to do. Select Save to keep them, Don’t Save to discard them, or Cancel to leave the workbook open.
Does closing a workbook also close Excel?
Usually, no. The shortcut closes the active workbook window, while Excel can remain open with another workbook or its start screen. To quit the app, use Alt+F4 on Windows or Command+Q on Mac.
Can I use Ctrl+W in Excel for the web?
It is not a dependable workbook-close shortcut in a browser. It commonly closes the browser tab. Check that edits have saved, then close the tab with the browser’s close control.
How do I close an Excel file without losing changes?
Save with Ctrl+S on Windows or Command+S on Mac, wait for the save to complete, and then close the workbook. If prompted, choose Save; choose Cancel if you need to return and check your work.
Related
- How to Center a Number in an Excel Cell: Quick Steps
- Center a Number in Excel: Steps, Options, and Fixes
- Capitalize in Excel: Shortcut Keys and Quick Methods
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Excel Document Not Responding? Causes and Safe FixesIf an Excel document is not responding, wait briefly before closing it: Excel may be calculating, loading data,…
- Mail Merge Toolkit in Word: How to Install and Enable ItTo add Mail Merge Toolkit to Word, download its Windows installer from the software publisher, close your Office…
- Excel Yellow Color Code: RGB, Hex, and Theme ValuesExcel’s standard pure-yellow fill is RGB 255, 255, 0, written in hexadecimal as #FFFF00. Choose the yellow square…
- How to Delete a Single Page in Word SafelyTo delete a single page in Word, click anywhere on it, press Ctrl+G on Windows (Option+Command+G on Mac),…
- Excel Heat Maps: Create, Format, and Read Color ScalesIn Excel, a heat map is usually a range of cells colored by value using Conditional Formatting. Select…
- Hanging Indent in Microsoft Word: How to Set It UpTo create a hanging indent in Microsoft Word, select the paragraph or paragraphs, open the Paragraph settings, and…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.