View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_4_] Don Guillett[_4_] is offline
external usenet poster
 
Posts: 2,337
Default Error if text not found


try this instead

Sub findem()
Dim Celle As String
Celle = ActiveCell
x = Sheets("Sheet6").Cells.Find(What:=Celle, After:=[A1],
SearchOrder:=xlByRows, _
SearchDirection:=xlNext).Address
Application.Goto Sheets("sheet6").Range(x)
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