Thread
:
Find instruction fails (from foreign sheet)
View Single Post
#
2
Posted to microsoft.public.excel.programming
Chip Pearson
external usenet poster
Posts: 7,247
Find instruction fails (from foreign sheet)
The problem is the line
After:=ActiveCell, _
because ActiveCell refers to a cell not on the sheet you are
searching in. You can omit this line of code, or change it to a
cell reference in Worksheets("Sheet1").Range("Database").
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"Kinne" wrote in message
om...
This code works when I call it from a button on the actual sheet
that
has to be querried:
Cells.Find(What:="search something", _
After:=ActiveCell, _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext,
MatchCase:=False).Activate
This code doesn't work and produces an error "1004 - Active
method of
Range class failed" when triggered from another sheet than the
one
that has to be querried:
Worksheets("Sheet1").Range("Database").Cells.Find( What:="search
something", _
After:=ActiveCell, _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext,
MatchCase:=False).Activate
It must be because of
"Worksheets("Sheet1").Range("Database")."... but
what is wrong???
Thanks for any help advice...
Kinne
Reply With Quote
Chip Pearson
View Public Profile
Find all posts by Chip Pearson