Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Find method Returns

How do i get the Find method to programmically return whether it found the
specified value or not?
--
Trent Argante
[DC.J(455)]
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Find method Returns

Try something like

Dim FoundCell As Range
Set FoundCell = Range(your_range).Find(what:="abc")
If Not FoundCell Is Nothing Then
Debug.Print "Found: " & FoundCell.Address
Else
Debug.Print "Not Found."
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Trent Argante" wrote in
message
...
How do i get the Find method to programmically return whether
it found the
specified value or not?
--
Trent Argante
[DC.J(455)]



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Find method Returns

For the find you have specified the What. Depending what you are looking for
(text or number) you should probably specify, LookAt (xlWhole, xlPart),
LookIn (xlformula, xlValues), MatchCase (true or false). Excel uses the last
setting that was used for a Find, which may or may not be what you want.

I have never had any luck determining the setting before doing the find
(Chip if there is a way I would love to know what it is.) so you may need to
modify these settings.
--
HTH...

Jim Thomlinson


"Chip Pearson" wrote:

Try something like

Dim FoundCell As Range
Set FoundCell = Range(your_range).Find(what:="abc")
If Not FoundCell Is Nothing Then
Debug.Print "Found: " & FoundCell.Address
Else
Debug.Print "Not Found."
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Trent Argante" wrote in
message
...
How do i get the Find method to programmically return whether
it found the
specified value or not?
--
Trent Argante
[DC.J(455)]




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Find method Returns

Chip & Jim,
Thank you, both, for your help. The code is running quite well now.
--
Trent Argante
[DC.J(455)]


"Jim Thomlinson" wrote:

For the find you have specified the What. Depending what you are looking for
(text or number) you should probably specify, LookAt (xlWhole, xlPart),
LookIn (xlformula, xlValues), MatchCase (true or false). Excel uses the last
setting that was used for a Find, which may or may not be what you want.

I have never had any luck determining the setting before doing the find
(Chip if there is a way I would love to know what it is.) so you may need to
modify these settings.
--
HTH...

Jim Thomlinson


"Chip Pearson" wrote:

Try something like

Dim FoundCell As Range
Set FoundCell = Range(your_range).Find(what:="abc")
If Not FoundCell Is Nothing Then
Debug.Print "Found: " & FoundCell.Address
Else
Debug.Print "Not Found."
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Trent Argante" wrote in
message
...
How do i get the Find method to programmically return whether
it found the
specified value or not?
--
Trent Argante
[DC.J(455)]




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
Find function returns the #VALUE! error value Ken Excel Discussion (Misc queries) 2 October 29th 06 01:59 AM
date find using find method x taol Excel Programming 2 December 22nd 05 09:51 AM
How to find returns in cells Bill Sturdevant Excel Worksheet Functions 1 April 25th 05 12:12 PM
Using variables to make a date and using find method to find that. KyWilde Excel Programming 2 April 21st 05 09:43 PM
Find Next in a selection, how to stop it when it returns to the fi Ron de Bruin Excel Programming 0 August 4th 04 02:47 PM


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

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

About Us

"It's about Microsoft Excel"