View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Rowan Drummond[_3_] Rowan Drummond[_3_] is offline
external usenet poster
 
Posts: 414
Default what is the best way to find a value in a sheet in VBA?

Just be aware that this will result in an error if xyz is not found.

Regards
Rowan

AG wrote:
Got it!
Sub test()
With Range("A1:A10").find("xyz", LookIn:=xlValues).Select
End With
End Sub

"AG" wrote:


Please help with the coding for .Find
Example, within a range A1:A10 I would have various values, apples, cans,
abc, toys, etc.
When I write Range("A1:A10").find("abc", LookIn:=xlValues) I get a compile
error of expected =
What am I missing?


"Tom Ogilvy" wrote:


It is the most general way if you don't want to loop.

You can also use the built in lookup, vlookup, match type functions.

--
Regards,
Tom Ogilvy


"serdar" wrote in message
...

.Find(x, LookIn:=xlValues)

Is this the only way?