G
Guest
The following is all the code in ThisWorkbook
Option Explicit
Private Sub WorkBook_Open()
Worksheets("LB").Range("A1:E1000").Clear 'Fail 1
CurrentEntry = -1
Worksheets("Main").Select 'Fail 2
Srch.Show
End Sub
This code fails with the message:
Run time error '57121':
Application-defined or object-defined error
The failure occurs on the line marked 'Fail 1
If I move the execution point to the next line and press F5 it fails with
the same message at the line marked 'Fail 2
If, at any point, I stop execution and re-execute the sub (by pressing F5)
it runs fine.
Worksheet "LB" exists and is hidden
Worksheet "Main" exists, is not hidden and is on top at open. (The select
statement is just incase the workbook was stopped with another worksheet
displayed.)
Remember this Sub works fine if I do nothing but stop and restart
execution.
Thanks very much for any help.
Option Explicit
Private Sub WorkBook_Open()
Worksheets("LB").Range("A1:E1000").Clear 'Fail 1
CurrentEntry = -1
Worksheets("Main").Select 'Fail 2
Srch.Show
End Sub
This code fails with the message:
Run time error '57121':
Application-defined or object-defined error
The failure occurs on the line marked 'Fail 1
If I move the execution point to the next line and press F5 it fails with
the same message at the line marked 'Fail 2
If, at any point, I stop execution and re-execute the sub (by pressing F5)
it runs fine.
Worksheet "LB" exists and is hidden
Worksheet "Main" exists, is not hidden and is on top at open. (The select
statement is just incase the workbook was stopped with another worksheet
displayed.)
Remember this Sub works fine if I do nothing but stop and restart
execution.
Thanks very much for any help.