Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Find Method doesn't work

I have a function that uses the find method to search for
a string within a spreadsheet. It works fine when called,
except when I call it from a For loop I get a RunTime erro
91: Object variable or with block variable not set.

Does anybody know why I keep getting this?
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Find Method doesn't work

I suspect you have a construct like

cells.Find("target").Select

if the target is not found, cells.find resolves to nothing so you have

nothing.Select
which raises that error. You should do

set rng = cells.find("target")
if not rng is nothing then
rng.select
Else
msgbox "Target not found"
End if

Regards,
Tom Ogilvy


"Slugo" wrote in message
...
I have a function that uses the find method to search for
a string within a spreadsheet. It works fine when called,
except when I call it from a For loop I get a RunTime erro
91: Object variable or with block variable not set.

Does anybody know why I keep getting this?



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
BreakLinks method doesn't work. Gop Excel Discussion (Misc queries) 0 September 1st 05 12:27 PM
find method? CG Rosén Excel Programming 2 November 12th 03 10:30 AM
The find method Stuart[_6_] Excel Programming 0 August 5th 03 03:14 PM
Help with the Find method Mike NG Excel Programming 3 August 4th 03 07:15 PM
Making VB PasteSpecial method to work the same as Excels Application John[_35_] Excel Programming 1 July 10th 03 05:20 PM


All times are GMT +1. The time now is 04:16 PM.

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

About Us

"It's about Microsoft Excel"