Macros
A Macro in Excel is a series of recorded actions that can be saved and played back as needed. Macros are written in a language called VBA (Visual Basic for Applications), and they can automate tasks like formatting, data entry, complex calculations, and more.
Macros are especially useful for repetitive tasks, allowing you to complete them with a single click or shortcut key.
Where is the option?
View Tab–>macros group
Example:
We want to format the above data like below:
- Make the header row bold and center-aligned.
- Apply a currency format to the sales column.
- Add borders around the entire data range
Also store the above formatting procedure to apply any other data.
Procedure:
- View TabàMacros Group–>Macro button–>Record Macro
The following dialog appears
- Fill the box as seen in the picture and click OK to start recording Macro
- Do your required formatting and click on stop recording when finished
- Use run macro option from View Tab or Keyboard Shortcut to apply same formatting style to any other desired data.
Practice Exercise
create a macro named HighlightLowSales to highlight any row where Sales are below 6000.