Excel's macro recorder translates the actions the user performs in the interface into VBA code, so they can be replayed later. It lets you start an automation and discover the corresponding code. The generated code is often verbose and tied to the selection, so it must be cleaned up and generalized before reuse.
Example
Developer > Record Macro, format a table, stop recording, then read the resulting code.