Wauvel

Excel like a finance pro.

← The library

VBA · Getting started

The VBA editor

Where macros are written and run; opened with Alt + F11.

Daily driverDifficulty 950 · Capable
Practice · 2 questions →

When to use it

The Visual Basic Editor is a separate window where all macros, functions, and event code live. It has a Project Explorer for the workbook's modules, a code window, and an Immediate window for testing one line at a time.

The code

Code
Alt + F11, then Insert > Module

Worked examples

  • First macro

    Alt + F11, Insert > Module, then type a Sub A new standard module with your first macro

    Standard modules hold ordinary macros.

  • Immediate window

    Ctrl + G in the editor, type ?Range("A1").Value, Enter The value of A1 prints in the Immediate window

    Test any expression without running a macro.

  • Find a sheet module

    View > Project Explorer, double-click Sheet1 The sheet module opens for event code

    Events go in sheet modules, not standard ones.

Worth knowing

  • Turn on Require Variable Declaration under Tools > Options so Option Explicit is added to every module.
  • F5 runs the current procedure, F8 steps one line, F9 sets a breakpoint.
  • Add the Developer tab (File > Options > Customize Ribbon) for a button that opens the editor.

Where it goes wrong

  • The editor window can hide behind Excel; Alt + F11 toggles it forward.
  • Code typed into the wrong module (a sheet module instead of a standard one) does not show in the Macros dialog.

Related

Learn the moves here — or let Wauvel run them on your numbers.

Meet your AI CFO →

One CFO-grade Excel tip a week

A short, practical email for finance operators — functions, shortcuts, and the moves that save an afternoon. Free, unsubscribe anytime.