I have a sheet with several blocks of data in it. My code is to simply go down the sheet from block to block and delete the blank lines between each block. (I'm preparing the data to be one big block that I can import into Access. The issue is when I get to the last block of data, the Range.End(xlDown) statement hits the bottom of the sheet and the Error 1004 Application Error is triggered. When I get to the end of the last block of data I want to end the procedure and Exit Sub. I have searched online and found an article which said I could use "On Error Resume Next" to "handle" the error but I couldn't get anything to happen other than the error message box (Error 1004 Application etc.) appearing.
blnBottom = False
On Error Resume Next
ActiveCell.End(xlDown).Offset(1, 0).Select
If Err.Number <> 0 Then
MsgBox "End of Data Input Area", vbCritical
Exit Sub
End If
Range(ActiveCell, ActiveCell.Offset(3, 0)).EntireRow.Delete
I have shown my attempt to "handle" the error in the code snippet above. All I want to do is exit the sub when I've reached the bottom of the last block of data. I've tried a few different variations on the theme but nothing has worked. Can you help please?