How do I add code into Excel?! (add a Macro)

We can do this in excel my adding a Macro.

The Steps

Add the Macro

Add the Developer Tab

Right click the Excel Ribbon & select Customize the Ribbon

Tick the Developer box & then OK

You will now have access to the Developer Tab in your ribbon

Select Visual Basic (VB) to bring up the VB editor

Now insert>Module (where we can put our code)

We can write or paste any code we have in here

Simply close the VB editor. No need to save, you will not loose anything.

Save the workbook as an .xlsm file type to save your Macros

Run the Macro

From the Developer tab select Macros

From here you can Run any macros you want

And there you have it, saving and running a macro (code) in excel!

Check out what is possible with Excel Macros!

microsoft documentation