Excel Guides

DOS From Macros in Excel

To create a macro, you first need to open the Visual Basic Editor (VBE). To do this, press Alt+F11 on your keyboard. This will open the VBE.

Once the VBE is open, you need to insert a new module. To do this, go to Insert > Module. This will insert a new module into the VBE.

Now that you have inserted a new module, you can start recording your macro. To do this, click on the Record Macro button on the toolbar (it looks like a little red circle).

Once you have clicked on the Record Macro button, Excel will prompt you for a name for your macro and a description (optional). It is a good idea to give your macro a name that describes what it does. For example, if your macro inserts a row in a worksheet, you could name it "InsertRow".

After you have given your macro a name and description, click on the OK button. Excel will now start recording your actions.

Now that Excel is recording your actions, carry out the steps that you want to automate. For example, if you want to insert a row in a worksheet, select a cell in the row below where you want the new row inserted, and then press Ctrl+Shift+Down Arrow on your keyboard (this will select the entire row). Then right-click on the selected row and click Insert.

Once you have carried out all of the actions that you want to automate, click on the Stop Recording button on the toolbar (it looks like a square).

Your macro is now complete! To test it out, make sure that the cell cursor is in the same row as where you inserted the new row earlier (i.e., one row below where you originally recorded the macro), and then press Alt+F8 on your keyboard. This will bring up the Macro dialog box.

In the Macro dialog box, select your macro from the list and click on Run. The macro will now run and insert a new row in the worksheet!

Move beyond 

Excel

Get started with Causal today.
Build models effortlessly, connect them directly to your data, and share them with interactive dashboards and beautiful visuals.