ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   On Error Goto doesn't goto (https://www.excelbanter.com/excel-programming/313658-error-goto-doesnt-goto.html)

Paul

On Error Goto doesn't goto
 
My "On Error goto" isn't working.

The following is a simple search. The search doesn't find the desired "2" so
it should go to EEERRR, but it doesn't; it gives an error message:

"Object variable or With block variable not set".

Any clue as to what that error message means?

Sub test2()
On error goto EEERRR

CCC = 2
Range("a10").Select
Cells.Find(What:=CCC, After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False).Select

EEERRR:
'some code here
End Sub

TIA!
Paul


All times are GMT +1. The time now is 01:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com