Wauvel

Excel like a finance pro.

← The library

VBA · Objects

The object model

Application contains Workbooks, which contain Worksheets, which contain Ranges; you drill down with dots.

Very commonDifficulty 1200 · Proficient
Practice · 2 questions →

When to use it

Excel exposes itself as a tree of objects: Application holds Workbooks, each holds Worksheets, each holds Ranges. Dots walk down the tree, and each object has properties (values) and methods (actions).

The code

Code
Application.Workbooks("Model.xlsx").Worksheets("Data").Range("A1")

Worked examples

  • Full path

    Application.Workbooks("Model.xlsx").Worksheets("Data").Range("A1") A fully qualified cell

    Explicit at every level.

  • A property

    ThisWorkbook.Worksheets("Data").Range("A1").Value = 1 Sets a value with an explicit sheet

    Value is a property.

  • A method

    ThisWorkbook.Worksheets("Data").Range("A1:C10").ClearContents Runs an action

    ClearContents is a method.

Worth knowing

  • Press F2 in the editor for the Object Browser, which lists every object and member.
  • Qualify ranges with a sheet; unqualified Range means the active sheet.
  • Charts, PivotTables, Names, and Shapes are collections on a worksheet.

Where it goes wrong

  • Unqualified Range("A1") reads the active sheet, which changes as the user clicks.
  • Some members are properties that return objects (Range returns a Range), which needs Set.

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.