A macro can be created by clicking Create Macro option present in the menu bar. There are two options by which you can create a macro. You can either write a macro or record one. Macros are written using Visual Basic.
To create a macro, follow the given steps:
Click Macros > Create Macros.
The following dialog box appears.

3. Name the macro that you wish to create. You can also describe the functioning of the macro.
4. You can choose to either record the macro or write the code for macro using VBA editor.
To create a macro by recording,
Click Macro > Record Macro.
Name the macro and continue recording.
Click on the box near Use Relative Reference if you want the cell referencing in the macro to be relative and not absolute.
There is a notification
to indicate that the recording has begun.
Make the changes that you wish to be recorded in the macro. They will be captured for your future use.
icon near the notification to stop the process.To play a recorded macro,
You can make use of events available to code your macro. The following are the events supported by Sheet:
Workbook Events:
1. Open
2. New Sheet
Sheet Events:
1. Change
A macro can also be assigned to a button for easy execution. To assign a macro to a button, follow the given steps:
Click Insert > Buttons.
Name the button now present in the sheet.
Click Assign Macro present near the button. Select an already existing macro or create a new macro to be assigned to the button created. 