on error - move down to next empty line, and proceed

heathball

Board Regular
Joined
Apr 6, 2017
Messages
132
Office Version
  1. 365
Platform
  1. Windows
Ok. i have looked at a few "error handling" websites. I would be shocked if this was difficult, but I cannot see it anywhere.
Before I begin, i want to send a warning to the newcomers.."on error resume next"...could clear the contents of your screen, and it could take you 11 seconds to know exactly why. It actually means the "Next Line," and upon 38 seconds of reflection, it is about all that it could mean.

If the '2' is in that column, then it deletes that row, and the rows below it.

On not finding a "2"...
i am trying to find a way for the "resume" to "not process the next 3 lines" - like - "go down to the next break/free line/empty line etc, and then start from there."
It is probably not via "resume." But i just want it perform a "hurdle" over the remaining contents of the paragraph, and continue/resume with "Sheets("RISA").Select"
I have a very strong internal dialogue, and it is pleading with me to stop typing. I don't think its helping.

If this pathway i have presented seems like trying to climb through a small window on the 3rd floor, just give me a quick hint on the location of the front door.

Much Obliged.


VBA 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
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
i think this an area which can be used....



VBA Code:
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
 
Upvote 0
I think it is solved.
if it stays this way, I'm pretty chuffed. It is the first time i have ever solved a thread.


VBA Code:
Columns("X:X").Select
    On Error GoTo errorHandler1
    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
    
    
errorHandler1:
    Range("X2").Select
 
Upvote 0
Solution

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top