Excel like a finance pro.
← The libraryPractice · 1 questions →
VBA · Ranges
Cells(row, column)
Refers to a cell by numbers, which makes looping easy.
Daily driverDifficulty 1000 · Capable
When to use it
Cells(row, column) refers to one cell by numbers, which is what loops need. Cells with no arguments is every cell on the sheet.
The code
- Code
Cells(i, 2).Value
Worked examples
In a loop
Cells(i, 2).Value → Column B of row i
Inside a For loop.
Column letter
Cells(1, "C") → A column letter works too
Mixed forms.
Build a range
Range(Cells(2, 1), Cells(lastRow, 3)) → A block built from numbers
Computed ranges.
Worth knowing
- Cells(Rows.Count, 1).End(xlUp).Row is the last used row of column A.
- Cells.ClearContents clears the whole sheet.
- Qualify with a sheet in both Range and Cells when building a range from them.
Where it goes wrong
- Range(Cells(...), Cells(...)) with the Cells on a different sheet than the Range errors.
- Cells(0, 1) errors; rows and columns start at 1.
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.