Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
AG AG is offline
external usenet poster
 
Posts: 54
Default what is the best way to find a value in a sheet in VBA?

Thanks to both Rowan & Tom for the additional insight.

"Rowan Drummond" wrote:

Try something like:

Sub findit()
Dim fndRng As Range
With Range("A1:A10")
Set fndRng = .Find("abc", LookIn:=xlValues)
End With
If Not fndRng Is Nothing Then
MsgBox "Found in cell: " & fndRng.Address
Else
MsgBox "Not Found"
End If
End Sub

Hope this helps
Rowan

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?






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can find sheet on workbook have so many sheet ? Huy Nguyen Excel Worksheet Functions 1 November 22nd 07 08:45 AM
find last row in a sheet Janis Excel Discussion (Misc queries) 3 November 7th 07 03:21 AM
Find data from one sheet in another sheet [email protected] Excel Worksheet Functions 3 August 21st 06 07:08 PM
how to find and copy values on sheet 2, based on a list on sheet 1 evanmacnz Excel Programming 4 February 7th 05 08:33 PM
Cant find sheet Jim73 Excel Programming 2 January 12th 05 01:59 PM


All times are GMT +1. The time now is 11:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"