How to insert macros in Excel

We sometimes lacking in standard features of Excel and we have to think about to write some function or find already written macros for solving required task. This raises the question: What is a macros, how to write it and where it insert?

Macros - it's a special program, which is written at embeded in Excel programming language VBA (Visual Basic for Application). The language is developed by Microsoft, special for program MS Office. How to write macros - it's a separate large subject, on which written hundreds of books and exist many sites, therefore we will not consider it in this article. Let's, nevertheless, analyze where we should insert macros in Excel.

Suppose we have prepared macros for merging cells together with text (remember that by default Excel during combining the cells leaves text only from the left upper cell). For this you should open Visual Basic Editor (Alt+F11), press right mouse button on Microsoft Excel Objects, choose Insert - Module:

Copy there our macro code:

Press save and return to Excel. Select the required cells and choose in menu View - Macros (Alt+F8) name of our macro:

Press Execute and we get the result we need:

Not so difficult...