# Macros

> Run workbook macros automatically after a Collect.

If your template uses VBA macros - to build a pivot, apply formatting, or run a
calculation - Calc can run them for you automatically every time data is
collected.

## Choosing macros to auto-run

<Steps>
  <Step title="Add your macros">
    Build the macros you need in the workbook's VBA project as usual.
  </Step>
  <Step title="Open the Macros picker">
    In Design mode, click **Macros**. Calc lists the macros in the workbook.
  </Step>
  <Step title="Tick and save">
    Tick the macros that should run after Collect, and save. Your choice is
    stored with the template.
  </Step>
</Steps>

## When they run

The ticked macros run **once a Collect finishes**, after the data and charts are
in place - so they can act on freshly collected data.

<Callout type="note" title="Macros mean a .xlsm template">
  A workbook with macros must be saved in Excel's macro-enabled format. Calc
  upgrades the template to `.xlsm` automatically when you save, or you can choose
  it explicitly in [Save As](/calc/building-templates/saving).
</Callout>
