View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
todd todd is offline
external usenet poster
 
Posts: 48
Default run time error 91 all of a sudden

turns out there is some goofy formatting issue - if the
cell contains 05007 and you type o5007 it returns the not
found but if you type 5007 it goes to the cell

thanks for the time todd


-----Original Message-----
You will get this error if the item you are searching for

is not found.

Sub gotoselection()
Dim rng as Range
set rng = Cells.Find(InputBox("Enter number to find"))
If not rng is nothing then
Application.Goto reference:=rng.Offset(, -2)
Else
msgbox "Item not found"
End if
End Sub

--
Regards,
Tom Ogilvy


"Todd" wrote in

message
...
Run time error 91 just started popping up on a macro

that
you all helped me with months ago.

erro 91 says object variable or With block variable not

set

The Marco is:

Sub gotoselection()
x = Cells.Find(InputBox("Enter number to

find")).Address
Application.Goto reference:=Range(x).Offset(, -2)
End Sub

I occasionaly change the -2 to a different number but it
always worked.

whats going on?

I am in column c right now and need to jump 2 spaces to
left so should be -2 like have been doing



.