J
jmootrey
Hi guys, I am running a loop to grab values from a fixed position i
relation to a unique model name. Sometimes the user asks for models tha
do not exist. On this case the value (forecast) should = 0. T
accomplish this I wrote an error trap, and it works on the firs
instance but if the user should ask for a second non existant model th
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
relation to a unique model name. Sometimes the user asks for models tha
do not exist. On this case the value (forecast) should = 0. T
accomplish this I wrote an error trap, and it works on the firs
instance but if the user should ask for a second non existant model th
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