find

  • Thread starter Thread starter ranswert
  • Start date Start date
R

ranswert

I am trying to write a simple "Find" Procedure that I will expand on once I
get it to work. I have:

Range("A1:G16").find(What:="abc", LookIn:=x1Values, LookAt:=x1Whole,
SearchOrder:=x1ByColumns).Activate

When I run it I get a "scpript out of range error". What am I doing wrong?
Thanks
 
You have a spelling mistake:
write xlValues instead of x1Values etc.!
Use an On Error statement, becouse Find generates an error in case of not
found.

Regards,
Stefi


„ranswert†ezt írta:
 
You might try changing your 1 's to l 's . Not typing here. 1 is no the same
as l.
Also, you need not activate or select to work with your find

mycell=Range("A1:G16").find("abc", LookIn:=xLValues, LookAt:=xLWhole, _
SearchOrder:=xLByColumns).address
 
Thanks alot

Stefi said:
You have a spelling mistake:
write xlValues instead of x1Values etc.!
Use an On Error statement, becouse Find generates an error in case of not
found.

Regards,
Stefi


„ranswert†ezt írta:
 
Hope this will help you
through Code make the selection of required range
and 'tofind' is the text you want to find

Set FoundText = Selection.Find(What:=tofind, After:=ActiveCell, LookIn _
:=xlvalues, LookAt:=xlwhole, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False)

If Not FoundText Is Nothing Then
FoundText.Select
FoundCellRow = ActiveCell.Row
Else
End If
 
It's not actually the .find that causes the error. It's the .activate that's
doing the damage.
 

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

Similar Threads


Back
Top