How to make a macro?
Watch the video
Each PC user works in a spreadsheet MS Office Excel processor - someone more often, someone less often, but in any case, most actions are reduced to routine - monotonous work from task to task. In order to increase the efficiency of their work and minimize monotonous actions, in the Excel there is a program - a macro, which, as practice shows, not everyone knows, but only a few of them use it. A macro is a program object written in the VBA programming language (Visual Basic for Application) and representing a sequence of actions. By the way, it is not necessary to program at all; you can write the operations we need into the macro (for example, text alignment and font for the title), simply by clicking on the desired icons.
How to make a macro in Excel?
- First, make sure that there is a "Developer" tab on the taskbar. By default, it is absent and you have to enable it:
- go to the tab "File", select the item "Parameters"
- go to the item "Configuring the tape" (in some versions of "Personal Settings") and in the menu that opens in the right window tick the tab "Developer", click "ok".
- go to the "Developer" tab that appears, find the "Macro Security" item in the "Code" group and select "Enable all macros".
- In the "Code" group, select "Record Macro".
- write the name of the macro
- create a shortcut for quick access. Note: make sure that this key combination is not busy so as not to override the call to an important function for you;
- click "save to": it is better to select "personal macro book" so that the created macro can be used at any launch of Excel;
- write down the description to know its purpose (all of a sudden you access the macro after a long period of time)
- Now it remains to create the formatting for the table, set the necessary formulas, etc.
- In the "Code" group, select "Stop Macro".
How to write a macro?
- We do the same thing as described in the chapter above under item 1.
- In the "Developer" tab, select "Visual Basic".
- In the window that opens, enter the program code, which will subsequently be assigned to the specified key combination. It should be noted that you do not need to write code from scratch; you can find a lot of ready-made modules in the world wide web.
- Connection of ready-made modules is carried out from the tab "Insert" → "Module".
- A preview of the created macro is done with the F5 key.
- After you finish creating the macro, open the "File" tab and select "Close and return to Microsoft Excel".
Having trained in writing your commands, you will realize that the macros in Excel are quite simple and fast, they are functionally rich and allow you to save most of your time for personal affairs.