The wikiHow Tech Team also followed the article's instructions and verified that they work. In this tutorial, I’ll show you different ways to run a macro in Excel. Go to the Developer tab –> Controls –> Insert –> Form Controls –> Button. With Excel VBA you can automate tasks in Excel by writing so called macros. If you’re interested in learning VBA the easy way, check out my Online Excel VBA Training. Note: You can also assign a macro to other interactive controls, such as a checkbox or scrollbar. Save the file as a macro enabled working and press F5 to run it. This is very useful for testing and troubleshooting. In this chapter, you will learn where and how to write the code for a macro. The macro program in Excel is limited to Excel. You can assign a macro to a button and then can run the macro by simply clicking that button. wikiHow's Content Management Team carefully monitors the work from our editorial staff to ensure that each article is backed by trusted research and meets our high quality standards. 9. If you are using a PC from work, that may be a safety feature from your IT department to prevent malicious code from affecting your PC or your network, and only they can modify it. Step - This will open the Visual Basic Editor to the first line of the macro. In Microsoft Office Excel 2003 or in Microsoft Excel 2002, point to Macro on the Tools menu, and then click Visual Basic Editor. 5. In Excel, you can create a macro by recording it or by writing code in the VB editor. Solve the most annoying tech problems, FAST. Thanks to all authors for creating a page that has been read 1,555,659 times. Name the macro. Once you use an outside program, Excel will be unable to record what you are doing. To run a macro from the VBA Editor, press either: F5 to run the entire code. Please consider supporting our work with a contribution to wikiHow. {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/b\/b5\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-1-Version-2.jpg\/v4-460px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-1-Version-2.jpg","bigUrl":"\/images\/thumb\/b\/b5\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-1-Version-2.jpg\/aid229922-v4-728px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-1-Version-2.jpg","smallWidth":460,"smallHeight":346,"bigWidth":728,"bigHeight":547,"licensing":"

License: Creative Commons<\/a>
\n<\/p>


\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/b\/b3\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-2-Version-3.jpg\/v4-460px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-2-Version-3.jpg","bigUrl":"\/images\/thumb\/b\/b3\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-2-Version-3.jpg\/aid229922-v4-728px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-2-Version-3.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"

License: Creative Commons<\/a>
\n<\/p>


\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/b\/be\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-3-Version-3.jpg\/v4-460px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-3-Version-3.jpg","bigUrl":"\/images\/thumb\/b\/be\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-3-Version-3.jpg\/aid229922-v4-728px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-3-Version-3.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"

License: Creative Commons<\/a>
\n<\/p>


\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/b\/b9\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-4-Version-3.jpg\/v4-460px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-4-Version-3.jpg","bigUrl":"\/images\/thumb\/b\/b9\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-4-Version-3.jpg\/aid229922-v4-728px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-4-Version-3.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"

License: Creative Commons<\/a>
\n<\/p>


\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/f\/f1\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-5-Version-3.jpg\/v4-460px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-5-Version-3.jpg","bigUrl":"\/images\/thumb\/f\/f1\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-5-Version-3.jpg\/aid229922-v4-728px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-5-Version-3.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"

License: Creative Commons<\/a>
\n<\/p>


\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/0\/02\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-6-Version-3.jpg\/v4-460px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-6-Version-3.jpg","bigUrl":"\/images\/thumb\/0\/02\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-6-Version-3.jpg\/aid229922-v4-728px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-6-Version-3.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"

License: Creative Commons<\/a>
\n<\/p>


\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/b\/b6\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-7-Version-3.jpg\/v4-460px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-7-Version-3.jpg","bigUrl":"\/images\/thumb\/b\/b6\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-7-Version-3.jpg\/aid229922-v4-728px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-7-Version-3.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"

License: Creative Commons<\/a>
\n<\/p>


\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/c\/c8\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-8-Version-3.jpg\/v4-460px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-8-Version-3.jpg","bigUrl":"\/images\/thumb\/c\/c8\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-8-Version-3.jpg\/aid229922-v4-728px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-8-Version-3.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"

License: Creative Commons<\/a>
\n<\/p>


\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/9\/92\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-9-Version-3.jpg\/v4-460px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-9-Version-3.jpg","bigUrl":"\/images\/thumb\/9\/92\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-9-Version-3.jpg\/aid229922-v4-728px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-9-Version-3.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"

License: Creative Commons<\/a>
\n<\/p>


\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/9\/96\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-10-Version-3.jpg\/v4-460px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-10-Version-3.jpg","bigUrl":"\/images\/thumb\/9\/96\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-10-Version-3.jpg\/aid229922-v4-728px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-10-Version-3.jpg","smallWidth":460,"smallHeight":349,"bigWidth":728,"bigHeight":552,"licensing":"

License: Creative Commons<\/a>
\n<\/p>


\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/1\/16\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-11-Version-2.jpg\/v4-460px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-11-Version-2.jpg","bigUrl":"\/images\/thumb\/1\/16\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-11-Version-2.jpg\/aid229922-v4-728px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-11-Version-2.jpg","smallWidth":460,"smallHeight":349,"bigWidth":728,"bigHeight":552,"licensing":"

License: Creative Commons<\/a>
\n<\/p>


\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/1\/14\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-12-Version-3.jpg\/v4-460px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-12-Version-3.jpg","bigUrl":"\/images\/thumb\/1\/14\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-12-Version-3.jpg\/aid229922-v4-728px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-12-Version-3.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"

License: Creative Commons<\/a>
\n<\/p>


\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/3\/33\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-13-Version-3.jpg\/v4-460px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-13-Version-3.jpg","bigUrl":"\/images\/thumb\/3\/33\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-13-Version-3.jpg\/aid229922-v4-728px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-13-Version-3.jpg","smallWidth":460,"smallHeight":348,"bigWidth":728,"bigHeight":551,"licensing":"

License: Creative Commons<\/a>
\n<\/p>


\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/3\/3e\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-14-Version-3.jpg\/v4-460px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-14-Version-3.jpg","bigUrl":"\/images\/thumb\/3\/3e\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-14-Version-3.jpg\/aid229922-v4-728px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-14-Version-3.jpg","smallWidth":460,"smallHeight":347,"bigWidth":728,"bigHeight":549,"licensing":"

License: Creative Commons<\/a>
\n<\/p>


\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/0\/01\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-15-Version-3.jpg\/v4-460px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-15-Version-3.jpg","bigUrl":"\/images\/thumb\/0\/01\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-15-Version-3.jpg\/aid229922-v4-728px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-15-Version-3.jpg","smallWidth":460,"smallHeight":344,"bigWidth":728,"bigHeight":545,"licensing":"

License: Creative Commons<\/a>
\n<\/p>


\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/8\/87\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-16-Version-3.jpg\/v4-460px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-16-Version-3.jpg","bigUrl":"\/images\/thumb\/8\/87\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-16-Version-3.jpg\/aid229922-v4-728px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-16-Version-3.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"

License: Creative Commons<\/a>
\n<\/p>


\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/7\/7b\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-17-Version-3.jpg\/v4-460px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-17-Version-3.jpg","bigUrl":"\/images\/thumb\/7\/7b\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-17-Version-3.jpg\/aid229922-v4-728px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-17-Version-3.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"

License: Creative Commons<\/a>
\n<\/p>


\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/6\/66\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-18-Version-3.jpg\/v4-460px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-18-Version-3.jpg","bigUrl":"\/images\/thumb\/6\/66\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-18-Version-3.jpg\/aid229922-v4-728px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-18-Version-3.jpg","smallWidth":460,"smallHeight":344,"bigWidth":728,"bigHeight":544,"licensing":"

License: Creative Commons<\/a>
\n<\/p>


\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/2\/2c\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-19.jpg\/v4-460px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-19.jpg","bigUrl":"\/images\/thumb\/2\/2c\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-19.jpg\/aid229922-v4-728px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-19.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"

License: Creative Commons<\/a>
\n<\/p>


\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/a\/a8\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-20.jpg\/v4-460px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-20.jpg","bigUrl":"\/images\/thumb\/a\/a8\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-20.jpg\/aid229922-v4-728px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-20.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"

License: Creative Commons<\/a>
\n<\/p>


\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/c\/ce\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-21.jpg\/v4-460px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-21.jpg","bigUrl":"\/images\/thumb\/c\/ce\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-21.jpg\/aid229922-v4-728px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-21.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"

License: Creative Commons<\/a>
\n<\/p>


\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/c\/c6\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-22.jpg\/v4-460px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-22.jpg","bigUrl":"\/images\/thumb\/c\/c6\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-22.jpg\/aid229922-v4-728px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-22.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"

License: Creative Commons<\/a>
\n<\/p>


\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/f\/f4\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-23.jpg\/v4-460px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-23.jpg","bigUrl":"\/images\/thumb\/f\/f4\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-23.jpg\/aid229922-v4-728px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-23.jpg","smallWidth":460,"smallHeight":344,"bigWidth":728,"bigHeight":545,"licensing":"

License: Creative Commons<\/a>
\n<\/p>


\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/4\/45\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-24.jpg\/v4-460px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-24.jpg","bigUrl":"\/images\/thumb\/4\/45\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-24.jpg\/aid229922-v4-728px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-24.jpg","smallWidth":460,"smallHeight":344,"bigWidth":728,"bigHeight":545,"licensing":"

License: Creative Commons<\/a>
\n<\/p>


\n<\/p><\/div>"}, {"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/d\/d1\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-25.jpg\/v4-460px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-25.jpg","bigUrl":"\/images\/thumb\/d\/d1\/Write-a-Simple-Macro-in-Microsoft-Excel-Step-25.jpg\/aid229922-v4-728px-Write-a-Simple-Macro-in-Microsoft-Excel-Step-25.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"