Getting Started: How to Create a Macro With a Shortcut
If you’ve been using Excel for years, you know that keyboard shortcuts are a game-changer. But did you know you can create your own shortcuts to automate repetitive tasks using macros? With just a few clicks, you can assign keyboard shortcuts to common workflows and supercharge your productivity.
Below are 10 custom Excel macros, each with a real-world use case and a suggested keyboard shortcut you can assign. Every one uses plain VBA, should run in desktop Excel on Mac and Windows, and can be pasted straight into your own workbook.
Record a macro and give it a shortcut
- Open the Developer tabGo to Developer → Record Macro. If you can’t see the Developer tab, switch it on in Excel’s options (Customize Ribbon on Windows, Ribbon & Toolbar on Mac).
- Name your macroPick a clear name with no spaces, for example HighlightRow.
- Assign a shortcut keyType a letter in the Shortcut key box, for example Cmd (Ctrl) + Shift + H. Type the letter in uppercase to get Shift as part of the combination.
- Perform the actionsDo the task you want repeated, once and without detours. Excel records each step.
- Click Stop RecordingClick Stop Recording, then test the macro on a spare sheet before you rely on it.
You can also fine-tune or write macros directly in the Visual Basic Editor — just press Fn + Option + F11 on Mac or Alt + F11 on Windows. Once you’re comfortable in the editor, you can go beyond simple recordings and start crafting smarter, more dynamic automations. And when you pair those macros with custom keyboard shortcuts, you unlock an incredibly efficient way to execute repetitive tasks with a single keystroke.
With a bit of creativity, this combination doesn’t just save time — it can streamline your entire workflow, reduce errors, and bring real polish to the way you work in Excel. In this article, I’ll share commonly used shortcuts along with their macro code — but keep in mind, the practical applications are virtually endless.
Or paste in the macros from this article
- Open the Visual Basic EditorPress Fn + Option + F11 on Mac or Alt + F11 on Windows.
- Insert a module and pasteChoose Insert > Module, then paste the code for the macro you want.
- Assign the shortcutBack in Excel, press Alt + F8 on Windows (or open Developer > Macros), select the macro, click Options and type your shortcut letter.
- Save as a macro-enabled workbookUse File > Save As and choose Excel Macro-Enabled Workbook (.xlsm). A normal .xlsx file drops the macro.
Which shortcut should you build first?
You don’t need all ten on day one. Start with the one that matches the work that annoys you most.
| If your day looks like… | Build these first | Why |
|---|---|---|
| Reviewing long data tables | Highlight the active row, Jump to last row | Keeps your place in transaction logs and audit sheets. |
| Cleaning files from other teams | Unmerge all cells, Consistent font, Auto-fit columns | Removes the formatting that breaks sorting and formulas. |
| Sending finished reports to clients | Convert to values, Format as table, Save and timestamp | Locks the numbers in and leaves you a backup. |
| Logging approvals or QA checks | Insert a timestamp | Builds a time-stamped audit trail with no typing. |
| Troubleshooting “rows are missing” | Clear all filters | Restores the full dataset in one keystroke. |
1. Highlight the Active Row
Use Case: When working with large data tables — like transaction logs or audit sheets — it’s easy to lose sight of the row you’re analysing. This shortcut quickly highlights the active row so you can focus visually and return to it after scrolling elsewhere. It’s particularly helpful during meetings, screen shares, or when comparing records line by line.
The macro reads the row number of the active cell and fills the whole row with pale yellow. It doesn’t follow your cursor, so think of it as a quick marker rather than a permanent rule.
2. Clear All Filters
Use Case: Imagine you’re reviewing a heavily filtered sales report. You’re not sure which columns have filters applied, but your data looks incomplete. Instead of hunting through each column filter menu, this shortcut instantly restores the full dataset. It’s also great during troubleshooting when users say, “Some rows are missing.”
ShowAllData reveals every hidden row on the active sheet. The error handling means nothing breaks if no filter is applied, and the filter buttons stay in place so you can filter again straight away.
3. Convert Formulas to Values
Use Case: You have just finished preparing financial forecasts with complex formulas referencing external files. Before sending the sheet to a client or saving for archival, you want to convert everything to static values to avoid reference errors. Select the range, hit the shortcut, and done. No paste special needed.
Setting a range’s Value to itself swaps each formula for the number or text it currently shows. Anything outside your selection is left alone.
4. Insert Timestamp in Active Cell
Use Case: Great for task tracking, approval logs, and QA checklists. Every time you update or review a row of data, use this shortcut to insert the exact date and time. It creates a transparent, time-stamped audit trail — no need to type anything manually or remember formulas like =NOW().
Unlike =NOW(), which keeps recalculating every time the sheet changes, the value this macro writes is fixed. That’s exactly what an audit trail needs. The code also applies an Australian day/month/year format.
5. Format as Table
Use Case: Working with structured data? Excel Tables come with built-in filter buttons, dynamic ranges for formulas, and visual styling. Instead of navigating through the ribbon to apply table formatting, this shortcut converts any selected range into a proper table — especially handy when preparing reports for clients or managers.
The macro assumes your selection includes a header row and needs at least two rows. If you select a single cell it does nothing rather than guess. It lets Excel choose the table name, so you can run it on many sheets without a name clash.
6. Unmerge All Cells in Sheet
Use Case: You receive a spreadsheet from another department, and it’s full of merged cells that break sorting, filtering, and formulas. One press of this shortcut instantly clears all merged formatting so you can reshape the data into something usable. It’s a lifesaver for data cleanup and importing into databases or Power BI.
Only the top-left cell of each merged area keeps its value once it’s unmerged, so you’ll usually need to fill the blank cells down afterwards. The macro covers the whole sheet, not just your selection.
7. Apply Consistent Font & Size
Use Case: You’ve just copied data from different sources, and now your worksheet is a visual mess — different fonts, sizes, and formatting. This shortcut standardises everything to a clean, readable style. Ideal for preparing deliverables, consolidating data, or simply making your workbook look professional.
The macro formats the cells you’ve selected, so press Ctrl + A (Cmd + A on Mac) first to cover the whole sheet.
8. Auto-Fit All Columns
Use Case: Whenever data is imported or pasted in, columns are often too narrow (cutting off content) or too wide. This shortcut instantly resizes all columns to fit their contents — no need to double-click column headers one by one. Great for polishing spreadsheets before sharing or printing.
Auto-fit sizes each column to its longest entry. One very long cell can therefore make a column enormous.
9. Jump to Last Row in Sheet
Use Case: In a growing list — like inventory, sales, or time logs — it’s often necessary to jump directly to the last row to add a new entry or review the latest one. This shortcut skips the scroll and lands you exactly where the action is happening.
The macro looks up from the very bottom of column A to find the last filled cell. If column A has gaps, change the 1 in the code to the number of a column that always has data (2 for column B, and so on).
10. Save and Timestamp the Workbook
Use Case: Before running risky changes (like mass find-and-replace or data transformations), use this shortcut to instantly create a backup version of your file with the current timestamp. It’s an insurance policy that takes less than a second. Also helpful for keeping periodic snapshots of work during long projects.
SaveCopyAs writes a copy without changing the file you’re working in, so you carry on as normal. The copy keeps the same file type and sits in the same folder, named Backup_ followed by the date and time. The folder separator is looked up from Excel, so the same code runs on Mac and Windows.
Avoiding shortcut clashes
A macro shortcut overrides Excel’s own shortcut with the same keys for as long as that workbook is open. That’s harmless for most of the combinations above, but three of them collide with everyday Excel actions in current Windows versions.
| Your shortcut | Excel normally uses it to… | What to do |
|---|---|---|
| Ctrl + Shift + F | Opens Format Cells on the Font tab | Swap the letter, or accept the override in this workbook. |
| Ctrl + Shift + U | Expands or collapses the formula bar | Swap the letter if you use a tall formula bar. |
| Ctrl + Shift + A | Inserts argument names while you type a formula | Swap the letter if you write formulas by hand. |
Add-ins and other macros can claim combinations too, so if a shortcut ever behaves oddly, change the letter and try again.
Bonus Tip: Use Personal Macro Workbook
To use your macros in any workbook, save them in the Personal Macro Workbook. Excel will automatically load them every time you open Excel.
When you record a macro, set Store macro in to Personal Macro Workbook. For a macro you typed or pasted, copy the code into a module in that workbook. Excel creates the personal workbook the first time you record something into it.
Common mistakes when building Excel shortcuts
Most macro frustrations come from the same five habits. Here’s what to avoid, and what to do instead.
Saving the file as .xlsx
InsteadSave as Excel Macro-Enabled Workbook (.xlsm), or keep the macro in your Personal Macro Workbook. A plain .xlsx drops the code without warning you twice.Picking a combination Excel already uses
InsteadCheck the clash table above, then choose a letter nothing else claims. While the workbook is open, your macro wins over the built-in shortcut.Running destructive macros with no backup
InsteadMacros clear Excel’s undo history, so Ctrl + Z may not rescue you. Run the timestamped backup macro before anything that changes lots of cells.Hard-coding ranges like A1:D20
InsteadUse ActiveCell, Selection or End(xlUp) so the macro adapts when the data grows or shrinks, as the macros in this article do.Copying every macro into every workbook
InsteadKeep your everyday macros in the Personal Macro Workbook. You fix a bug once, and the improvement shows up in every file.When to get help with Excel macros
Shortcuts like these are a great start. If you’re repeating a job that a single macro can’t cover, or a process pulls data from several files, our team can design it properly with custom Excel development.
Frequently asked questions
Do these shortcuts work on both Mac and Windows?
The macros use standard VBA, so they should run in desktop Excel on both. The key combinations differ slightly: on Mac, the Record Macro box may suggest Option + Cmd rather than Cmd + Shift, so use whatever the dialog offers. Test each macro on your own version before relying on it.
Can I use macros in Excel for the web?
No. Excel for the web can’t run VBA macros, so open the file in the desktop app. The shortcuts only exist while the macro does.
Do I need to know VBA to create my own shortcuts?
Not to start. The macro recorder writes the code for you while you work. Typing or editing VBA simply lets you handle more situations, such as the last row of any list. If you’d rather not write code at all, our team can build custom Excel development around your process.
Why does my shortcut do nothing?
The usual causes are that the workbook holding the macro isn’t open (unless it’s in your Personal Macro Workbook), macros are switched off, the file was saved as .xlsx, or the shortcut letter was entered in lowercase so it became Ctrl + letter instead of Ctrl + Shift + letter.
Can I undo a macro?
Usually not. Running a macro clears Excel’s undo history, so keep a backup. The timestamped save macro (number 10) takes less than a second and gives you a way back.
Final Thoughts
Creating your own shortcuts with macros is like unlocking a secret level in Excel. What might take five or six clicks — repeated dozens of times a day — can be reduced to a single keystroke. These automations are invaluable for professionals who work with large volumes of data or follow strict reporting workflows — from analysts and accountants to consultants and operations managers.
The beauty of combining macros with shortcuts is that it scales with your needs. Start small with one or two time-savers, then gradually create a toolkit of personalised automations tailored to your role and your team. Over time, it becomes second nature — and you’ll wonder how you ever worked without them.


