View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
OkieViking OkieViking is offline
external usenet poster
 
Posts: 37
Default Repeat Error message

I am writing a macro that will search through multiple sheets in a workbook, looking for every occurence of a word. For each "hit" I copy the row containing the hit into a different workbook. The macro is structured as follows: There is one loop for each sheet. For each sheet I continue searching and copying 'til I find the first hit again. at that point I exit the loop. That loop is inside a bigger loop that cycles through all the sheets in the workbook. If there ar no hits in a worksheet, Excel creates an error. I have a "On Error GoTo Done" statement where Done: is outside the inner loop (i.e. when an error occurs I am done with that sheet and move on to the next sheet). I also reset Err = 0. This appears to work fine. When there are multiple sheets with no hits, the program crashes. It is able to catch the first error occurence, but not the second (Error 91 btw).

Any suggestions?