how can i get this box to accept my question? Question - VBA error GOTO challenge

40 Views Asked by At

I am trying to use "Error goto" and I think its not difficult.

I am trying to get the 2nd VBA code to... on error, jump to "Sheets("RISA").Select" if the find within the column is an error

If it finds the "2" - it enacts the select and delete

If it does not find the "2" it "jumps over the Select and delete" and ignores it.

how would i use an error handler for this, and the "On Error GoTo -1' is confusing.

Can anyone assist?

This is not my code..this is what i am trying to add to my code below it.

On Error GoTo errorHandler1
    Windows(myFile).Activate
    Sheets(secondDetailTab).Activate
    'bunch of code
errorHandler1:

    'bunch of code
    
    On Error GoTo -1
    On Error GoTo errorHandler2
    Windows(myFile).Activate
    Sheets(secondDetailTab).Activate
    'bunch of code
errorHandler2:

    'bunch of code

this is my code.......

Columns("X:X").Select
    Selection.Find(What:="2", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
        xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
        , SearchFormat:=False).Activate
    ActiveCell.EntireRow.Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Delete Shift:=xlUp


Sheets("RISA").Select
0

There are 0 best solutions below