In this post, we will work on some­thing we should con­sid­er before start­ing record­ing our first macro. 

Excel VBA — Prepa­ra­tion before record­ing first macro | Intro­duc­tion to macros and VBA 01

First of all, in the Devel­op­er tab, we have the Record Mar­co com­mand. We can also find this com­mand in the sta­tus bar on the left side. It make it eas­i­er to start our record­ing (Fig. 1)

 Record Macro command in the status bar
Fig. 1 Record Macro com­mand in the sta­tus bar

Then, we should con­sid­er rel­a­tive and absolute ref­er­ence. We have the Use Rel­a­tive Ref­er­ences com­mand. If it isn’t high­light­ed, it means that we work with absolute ref­er­ences. For exam­ple, if I select cell B9, then select cell B12, Excel will record this as ‘select cell B12′. When I turn on the Use Rel­a­tive Ref­er­ence com­mand, then select cell B9, and then cell B12, Excel will record this step as ‘go three rows down’. This issue is very impor­tant when record­ing our macro. 

Let’s click on the com­mand one more time to turn it off and work with absolute reference. 

There is one more com­mand to look into. It’s called Macro Secu­ri­ty. After click­ing it, we have a Trust Cen­ter win­dow. In the Mar­co Set­tings area, we can see an option of Dis­able VBA macros with noti­fi­ca­tions (Fig. 2)

Disable VBA macros with notifications option
Fig. 2 Dis­able VBA macros with noti­fi­ca­tions option

This option should be select­ed by default. It means that when we open a file with macros (with an xmls exten­sion), we will have infor­ma­tion that this file con­tains macro, and some code can be run with­out our knowl­edge. How­ev­er, in most cas­es, we should­n’t be afraid of this code. It’s a code which we copy from secure sources, like Google. Google is quite a secure source, as it shows you good web­sites, not dan­ger­ous ones. 

When you start work­ing with VBA, you should know some­thing about the VBA code. If you see some­thing unfa­mil­iar, you should­n’t run this code. 

I per­son­al­ly don’t like noti­fi­ca­tions, espe­cial­ly the ones that show up every time I open a file con­tain­ing macros. That’s why, in most cas­es I’m work­ing with the Enable VBA macros option. It’s not rec­om­mend­ed, how­ev­er, from my point of view it’s prac­ti­cal. I’ve been work­ing with macros for many years, and I haven’t come across any dan­ger­ous code. The most dan­ger­ous thing a VBA code has done to me is rewrit­ing my cur­rent data. 

Hav­ing the above in mind, when you run macros and you don’t ful­ly know what they are doing, you should always cre­ate a back­up copy before.

The above are the most sig­nif­i­cant pieces of infor­ma­tion you should con­sid­er before record­ing your first macro. In the next post, we will be record­ing our first macro. 

https://www.youtube.com/watch?v=L9TDg-vRC48