Excel like a finance pro.
VBA · Ranges
Find
Searches a range for a value and returns the first matching cell, or Nothing.
When to use it
Range.Find searches a range for a value and returns the first matching cell, or Nothing when there is no match. Faster than a loop and it mirrors the Find dialog.
The code
- Code
Set c = Range("A:A").Find("Total", LookAt:=xlWhole) If Not c Is Nothing Then MsgBox c.Row
Worked examples
Find a label
Set c = Range("A:A").Find("Total", LookAt:=xlWhole) If Not c Is Nothing Then MsgBox c.Row → The row of the first exact "Total"
Always test for Nothing.
Explicit options
Set c = rng.Find(What:="ACME", LookIn:=xlValues, MatchCase:=False) → Case-insensitive value search
Specify LookIn and LookAt every time.
All matches
Set first = rng.Find("x") Set c = first Do Set c = rng.FindNext(c) Loop While Not c Is Nothing And c.Address <> first.Address → Loops through every match
The FindNext pattern.
Worth knowing
- Find remembers the last options used, even from the dialog, so set LookAt and LookIn explicitly.
- Application.Match is faster for exact lookups in one column.
- Search formulas with LookIn:=xlFormulas.
Where it goes wrong
- Using c.Row without the Nothing test raises error 91.
- Find on merged cells behaves oddly.
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.