Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Clearing Errors
I have tried hard to make this code work but I have not been successful. Sheets("CustData").Activate Num = Sheets("CustData").Range("DG5001") For x = 1 To 4 If x = 1 Then CustN = Sheets("OrderEntry").Range("D7") Else CustN = Sheets("OrderEntry").Cells((x - 2) * 14 + 23, 4) Sheets("CustData").Range(Cells(6, 1), Cells(Num + 10, 1)).Select On Error GoTo Line2 Selection.Find(What:=CustN, After:=ActiveCell, LookIn:=xlValues, LookAt:= _ xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:= _ False).Activate Row = ActiveCell.Row Sheets("CustData").Range(Cells(Row, 1), Cells(Row, 110)).ClearContents Sheets("CustData").Cells(Row, 112).ClearContents Line2: If Err.Number < 0 Then Err.Clear Next x In this example CustN="" for all x's. The code works fine for the first x. It jumps to Line2 and proceeds to the next x. However the "Find" line fails with a runtime error 91 when x =2, 3 or 4. What am I doing wrong? Thanks for your help. Jim Walsh |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Clearing cells without clearing formulas | Excel Discussion (Misc queries) | |||
Clearing RAM | Excel Programming | |||
Excel Throwing Circular Errors When No Errors Exist | Excel Worksheet Functions | |||
Clearing #VALUE | Excel Worksheet Functions | |||
Unresolved Errors in IF Statements - Errors do not show in results | Excel Worksheet Functions |