In Excel: Press Alt + F8, select the macro by name, and click Run — or press F5 with the cursor inside the Sub in the VBA editor.
VBA macro: Run a Macro in Excel
Sub RunMeFromTheMacroDialog()
Dim ws As Worksheet
Dim started As Double
Set ws = ActiveSheet
started = Timer
ws.Range("A1").Value = "Ran at " & Format(Now, "yyyy-mm-dd hh:mm:ss")
MsgBox "Macro completed in " & Format(Timer - started, "0.000") & " seconds.", vbInformation
End SubTimer returns seconds since midnight, so subtracting a start value times the run. Stamping the sheet as well as showing a dialog proves the macro really executed rather than merely appearing to.
How to run this macro
- Press Alt + F11 to open the VBA editor.
- Insert > Module.
- Paste the code above.
- Press
F5, or close the editor and run it from Developer > Macros. - Save the file as .xlsm so the macro is kept.
Open the workbook and click Enable Content if the security bar appears — macros will not run while the file is blocked.
Press Alt + F8 to open the Macros dialog.
Select the macro by name; the list shows every public Sub across all open workbooks.
Click Run, or click Options first to attach a Ctrl + Shift + letter shortcut.
To run while editing instead, press Alt + F11, click inside the Sub, and press F5.
What this does
There are four practical ways to start a macro, and which one you want depends on who is doing the starting. Alt + F8 opens the Macros dialog listing every public Sub in every open workbook; select and click Run. That is the general-purpose route. F5 inside the editor runs whichever Sub the cursor currently sits in, which is what you use while building and testing. A keyboard shortcut can be attached under Alt + F8 ▸ Options — pick a letter with Ctrl + Shift rather than plain Ctrl, since plain Ctrl + letter combinations overwrite Excel's own shortcuts for that session. Finally, a button or shape with Assign Macro puts it in front of colleagues who will never learn any of the above. There is also automatic execution — event procedures in ThisWorkbook such as Workbook_Open run without anyone asking, which is powerful and worth being deliberate about. Keep the inputs visible and clearly labelled and the whole thing stays auditable — anyone who opens the file later, including you, can see at a glance exactly what feeds the result and change one assumption without hunting through the formula. Treat “use macros in excel” as a small repeatable workflow rather than a one-off click you hope to remember next time. Use a small test block before the live file, so any surprise in the affected cells shows up while it is still harmless. When this is a ribbon command, the selection matters more than the button: confirm the range, apply the command, then spot-check the output before saving. That turns a workflow that saves repeating the same clicks every week into a method you can reuse, explain, and defend when the workbook leaves your screen.
A worked example
A workbook arrives with a macro called RefreshReport. Click Enable Content on the yellow bar, then press Alt + F8. The dialog lists RefreshReport; select it and click Run. To time it or watch it work, press Alt + F11 instead, click anywhere inside the Sub, and press F5 — that runs the same code but leaves you in the editor where Debug.Print output and any error dialog are visible. Paste Sub RunMeFromTheMacroDialog() into a module and run it both ways: A1 gets a timestamp and the dialog reports the elapsed time, so you can tell at a glance that it ran and how long it took. If the macro does not appear in the Alt + F8 list at all, it is Private, it takes arguments, or it lives in a sheet object rather than a standard module. Knowing all four entry points matters because they fail differently: F5 shows you the error, a button hides it, and a keyboard shortcut can collide with Excel's own. Picking the right one for the audience is most of what makes an automation usable by someone other than its author. If there is any chance you will reuse this, drop it into a small template tab right now: a labelled input area on the left and the formula beside it, checked once against the tool above. Next time the same question comes up, the answer is a single paste away instead of a rebuild from memory.
In Google Sheets
Google Sheets handles this almost identically to Excel. The formula syntax above is the same, and the menu lives under a slightly different label rather than a ribbon tab. Use the platform toggle at the top of the page to switch every keyboard shortcut between Windows and Mac, and expect at most cosmetic differences in naming. The aim was to get you unstuck fast and leave you a little more capable than a copy-paste would. The answer is at the top, the tool proves it, and the detail above shows why it holds — so the next time a colleague asks, you can answer without reaching for search. Treat “use macros in excel” as a small building block rather than a chore. Once the inputs sit in their own cells and the formula reads from them, the same setup answers a dozen related questions with a tweak, and Excel keeps every dependent figure current as the data changes. The tool above is there so you can rehearse and verify before committing anything to a real workbook; the steps and worked example are there so the logic sticks. Get it right once and it stops costing you time — it starts saving it, every time the question comes back around.
Common mistakes
- Running a macro that modifies data without a backup. VBA writes bypass Excel's undo stack, so Ctrl + Z cannot recover anything a macro changed — test on a copy first, every time.
- Assigning a plain Ctrl + letter shortcut. It silently overrides the built-in shortcut for as long as the workbook is open, so Ctrl + C or Ctrl + S can stop doing what everyone expects. Ctrl + Shift + letter is the safe range.
- Expecting a macro from workbook A to find data in workbook B. Unqualified references like Range("
A1") resolve against whatever is active at the moment the line executes, so which sheet you are looking at when you press Run changes the result. - Concluding a macro is missing because Alt + F8 does not list it. Private Subs, Subs that take arguments, and code inside sheet objects are all hidden from that dialog while still being perfectly runnable with
F5.
Frequently asked questions
What is the keyboard shortcut to run a macro?
Alt + F8 opens the Macros dialog on the sheet; F5 runs the current Sub inside the VBA editor. You can assign a personal shortcut per macro under Alt + F8 ▸ Options.
How do I stop a macro that is taking too long?
Press Esc, or Ctrl + Break. The editor then offers Continue, End or Debug — Debug stops on the current line so you can see where it was stuck.
Can a macro run automatically when the workbook opens?
Yes. A Private Sub Workbook_Open() in the ThisWorkbook module runs on open, and Worksheet_Change in a sheet module runs whenever a cell there is edited. Both still require macros to be enabled.
Why does nothing happen when I click Run?
Most often macros are still disabled, or the Sub really did run but acted on a different sheet than the one you are looking at. Add a MsgBox as the last line to confirm it reached the end.
Other ways people ask this
On the way here you may have searched this as “how do i use macros in excel”, “using macros in excel”, “how to use macro in excel” and “how to use a macro in excel” — it is all the same task, and this page is the single, complete answer to it.
Platform & version notes
- Several of those searches mention Google Sheets — and the good news is that "use macros in excel" works there almost identically: the formula syntax carries over unchanged, only the surrounding menus sit across the top of the screen instead of in a ribbon.
Can I do this in Google Sheets too?
Yes. "use macros in excel" carries over to Google Sheets with the same formula and almost the same steps — the menus are arranged differently, but the result is identical.
Why do people search for this in so many different ways?
Because the same task has many names. “how do i use macros in excel”, “using macros in excel”, “how to use macro in excel” all point at the one operation explained on this page, which is why they all lead here.