LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Need help on error msg for "find()"

I have a sub simplifed as following to search for "Activity ID" on a
worksheet as shown below

0 sheets(5).activate
1 range("A3").select
2 i = 3
3 while i < 200
4 Activity_ID = Sheets(3).range("P" & cstr(i))
5 On Error GoTo Err_ACT_NOT_FOUND
6 ' Performs a search on a sorted list in the active worksheet
(i.e. sheets(5)
7 Cells.Find(What:=Activity_ID, After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt :=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext,MatchCase:=False, _
SearchFormat:=False).Select
8 On Error GoTo 0
9 ' process the data once the desired Activity ID is found
10 i = i + 1
11 Goto SKIPOVER
12 Err_ACT_NOT_FOUND:
13 Msgbox "Activity ID '" & Activity_ID & "' not found.", VbInformation
14 SKIPOVER:
15 Wend

When it first encounters an Activity ID does not exist in "Sheets(5)", it
displays the message 'Activit ID xxxx not found ok. However, when it cannot
find another Activity ID in sheets(5), Excel prompts me the following error
msg:
Run-time error '91:'
Object variable or With block variable not set.
When I click debug, it points at line # 7 which is the "Cells.Find (...."
command.

Can someone please tell me what is the problem with this find stmt resulting
in this error msg ?

Thanks in advance for any help.


 
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
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
"FIND" generates "Type mismatch" error quartz[_2_] Excel Programming 5 November 16th 04 03:29 PM
Trim: Excel 97 gives error "Can't find project or library" Jim Mooney Excel Programming 10 August 30th 04 08:22 PM
Excel 97 ADODB Recordset.Find "Invalid Use" error Robin Hammond[_2_] Excel Programming 1 August 27th 04 12:47 PM


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

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"