Find arguments

  • Thread starter Thread starter Zone
  • Start date Start date
Z

Zone

When I use Find in code, I generally want a "no-frills" find, so
Set c = Cells.Find("abc")
works just fine to find "abc" in the values, any part of the values,
ignoring case. But, testing this, I see that if the user has set find
options differently, find remembers and searches according to those rules.
Rats! So I have to include arguments, like
Set c = Cells.Find("abc", LookIn:=xlValues, lookat:=xlPart,
MatchCase:=False)
Is there anyway to set find back to "no frills", or default settings, so I
don't have to include all those arguments? TIA, James
 
I'm afraid not. If those are the arguments you want .Find to use, and there
is a chance that they would be changed in the worksheet, then you have done
what needs to be done. Your only alternative would be to close Excel and
re-open it. The default settings would then be re-applied. Probably not what
you want to do.

Mike F
 
Thank you, Mike. If I remember my basic rules about arguments, I could
include them without the argument names if I have them in the right order.
But it's probably more trouble than it's worth (and definitely more
dangerous) to try to remember where all those commas go. I hope I haven't
given anyone bad advice in here. I'll just include the arguments (and their
names) with Find from now on. Regards, James
 
Zone said:
Thank you, Mike. If I remember my basic rules about arguments, I could
include them without the argument names if I have them in the right order.
But it's probably more trouble than it's worth (and definitely more
dangerous) to try to remember where all those commas go.

And much, much harder to read at some future date when you might be
reviewing your code for some reason. Which of these do you think you would
be able to figure out some months after you wrote them?

Set c=Cells.Find("abc", LookIn:=xlValues, LookAt:=xlPart, MatchCase:=False)

Set c=Cells.Find("abc", , xlValues, xlPart, , , False)

Rick
 
Exactly, Rick!
Rick Rothstein (MVP - VB) said:
And much, much harder to read at some future date when you might be
reviewing your code for some reason. Which of these do you think you would
be able to figure out some months after you wrote them?

Set c=Cells.Find("abc", LookIn:=xlValues, LookAt:=xlPart,
MatchCase:=False)

Set c=Cells.Find("abc", , xlValues, xlPart, , , False)

Rick
 
LOL.. Well, yeah, technically, but I consider the first argument a
"given"... not too many people I know decide to place a first argument
(whether it be "What" or anything thing else) out of sequence.

Rick
 
gd&r? Huh? Am I losing my web savvy? ;)

Rick Rothstein (MVP - VB) said:
LOL.. Well, yeah, technically, but I consider the first argument a
"given"... not too many people I know decide to place a first argument
(whether it be "What" or anything thing else) out of sequence.

Rick
 
Whoops! The gd&r wasn't yours, was it? Ignore my other post... the gd&r
means "grin, duck and run".

Rick


Zone said:
gd&r? Huh? Am I losing my web savvy? ;)
 
ty, Rick. I'm up to speed again! ;)

Rick Rothstein (MVP - VB) said:
Whoops! The gd&r wasn't yours, was it? Ignore my other post... the gd&r
means "grin, duck and run".

Rick
 
ty????
<gd&rvvf>

(Thank you)
(Grin, duck and running, very very fast)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top