Thread
:
Error if text not found
View Single Post
#
2
Posted to microsoft.public.excel.programming
Don Guillett[_4_]
external usenet poster
Posts: 2,337
Error if text not found
try this. Change sheet6 to your sheetname
Sub findem()'from activecell on source sheet
Dim Celle As String
Dim x As Range
Celle = ActiveCell
x = Sheets("Sheet6").Cells.Find(What:=Celle, After:=[A1],
SearchOrder:=xlByRows, _
SearchDirection:=xlNext).Address
Application.Goto Sheets("sheet6").Range(x)
'usually NOT necessary to select
End Sub
--
Don Guillett
SalesAid Software
"Jens Nielsen" wrote in message
. dk...
I am trying to get a Excel-macro to lookup text in a cell on one worksheet
and find the same text in another worksheet.
It works fine until it reaches a text that can't be found on the other
worksheet.
This is my code
Dim Celle As String
Celle = ActiveCell
Sheets("Stykliste").Select
Cells.Find(What:=Celle, After:=[A1], SearchOrder:=xlByRows,
SearchDirection:=xlNext).Select
I get a "Run-time Error 91"
What am I doing wrong?
Regards
Jens Nielsen
Reply With Quote
Don Guillett[_4_]
View Public Profile
Find all posts by Don Guillett[_4_]