Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default run time error 91 all of a sudden

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default run time error 91 all of a sudden

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
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



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
All of a sudden none of my Excel formulas are working... Trina Excel Worksheet Functions 3 July 1st 08 10:58 PM
all of a sudden - something's different davey1108 Excel Discussion (Misc queries) 3 September 16th 07 05:09 AM
All of the sudden my charts aren't active, what happened? khillAESCorp Charts and Charting in Excel 0 April 10th 06 04:44 PM
Sudden Background Change to only one file diana Excel Discussion (Misc queries) 4 March 11th 06 05:33 PM
all of a sudden I can not see the graphs I made yahusaan Excel Discussion (Misc queries) 1 January 28th 06 01:23 PM


All times are GMT +1. The time now is 07:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"