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: 1
Default Error trapping not working


Hi guys, I am running a loop to grab values from a fixed position in
relation to a unique model name. Sometimes the user asks for models that
do not exist. On this case the value (forecast) should = 0. To
accomplish this I wrote an error trap, and it works on the first
instance but if the user should ask for a second non existant model the
seleciton.find command errors out with run time code 91.
---- CODE ---
Do While model < ""
On Error GoTo notfound
Sheets("database").Columns("B:B").Select
Selection.Find(What:=model, LookAt:=xlWhole, SearchOrder:=xlByRows,
SearchDirection:=xlNext, _
MatchCase:=False).Select
forecast = ActiveCell.Offset(0, 7 + week)
continue:
Sheets("work").Range("A" & rowcount + 8) = model
Sheets("work").Range("B" & rowcount + 8) = forecast
model = Sheets("data").Range("A" & modelcount)
rowcount = rowcount + 1
modelcount = modelcount + 1
Loop
Sheets("work").Activate
End If
Exit Sub
notfound:
forecast = 0
GoTo continue
End Sub


--
jmootrey
------------------------------------------------------------------------
jmootrey's Profile: 1387
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=184562

Microsoft Office 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
Error trapping is not working for errors related to files BAC Excel Programming 9 August 10th 07 10:36 PM
while deleting rows it finds an error - error trapping Janis Excel Programming 2 July 19th 07 12:12 AM
Error Trapping Still Not Working Ken[_18_] Excel Programming 5 May 17th 04 11:24 PM
Error Trapping Still Not Working Ken[_18_] Excel Programming 0 May 17th 04 06:51 PM
trapping error RobcPettit Excel Programming 2 January 30th 04 03:37 AM


All times are GMT +1. The time now is 01:48 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"