This post starts a series about an intro­duc­tion to macros and VBA code. 

Excel VBA — What is a macro and enabling the Devel­op­er tab 

What is a macro? In most cas­es it’s a syn­onym for VBA code that we run. It’s almost the same thing. Some­times we dif­fer­en­ti­ate it and we call macros the VBA code that was record­ed by Excel — Record Mar­co com­mand. If we want to use this com­mand, we should turn on the Devel­op­er tab. In order to do that, we have to right-click on our rib­bon and go the Cus­tomize the Rib­bon com­mand (Fig. 1)

Customize the Ribbon command
Fig. 1 Cus­tomize the Rib­bon command

In the Excel Options win­dow that has appeared, we have to find the Devel­op­er tab on the right side, press it and press OK (Fig. 2)

 Developer tab
Fig. 2 Devel­op­er tab

Now, we can see that in the Devel­op­er tab we have the Record Mar­co com­mand (Fig. 3)

 Record Macro command
Fig. 3 Record Macro command

This com­mand allows us to record actions we are doing on a work­sheet, such as cell for­mat­ting, putting val­ues in a cell, size mod­i­fi­ca­tion, etc. It’s a good place to start learn­ing about the VBA code. 

Macros are good for two main reasons. 

First, they are good for repeat­ing tasks. If we want to make reports on a dai­ly basis, we can just record all actions we are doing in a work­sheet and then we are able to use it again, prob­a­bly with tiny mod­i­fi­ca­tions. We will have a report for­mat by run­ning macro. 

Sec­ond, the VBA code allows us to do the things that are not pos­si­ble or very hard when using Excel func­tions. Those things will be much sim­pler using the VBA code. It may even hap­pen that some­body has already writ­ten a prop­er code to this task. 

If we want to save macro, we have to use the ‘xlsm’ exten­sion, where ‘m’ stands for macros. We can run macros on ‘xlsx’, which is a stan­dard exten­sion for Excel, how­ev­er Excel won’t save macros in those files. Remem­ber, only ‘xlsm’ works for macros. 

https://www.youtube.com/watch?v=bUR7BQ4bglA