Re: Why does this simple Sub fail?
- From: "Don Guillett" <donaldb@xxxxxxx>
- Date: Mon, 28 Nov 2005 10:22:51 -0600
You have option explicit and failed to dim
--
Don Guillett
SalesAid Software
donaldb@xxxxxxx
<NoSpam99989@xxxxxxx> wrote in message
news:du7mo1hvlaetvlc9vdd68ljv5iu41q68hb@xxxxxxxxxx
> 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.
>
> Work*** "LB" exists and is hidden
> Work*** "Main" exists, is not hidden and is on top at open. (The select
> statement is just incase the workbook was stopped with another work***
> displayed.)
>
> Remember this Sub works fine if I do nothing but stop and restart
> execution.
>
> Thanks very much for any help.
.
- Follow-Ups:
- Re: Why does this simple Sub fail?
- From: NoSpam99989
- Re: Why does this simple Sub fail?
- References:
- Why does this simple Sub fail?
- From: NoSpam99989
- Why does this simple Sub fail?
- Prev by Date: Re: Insert Line maintaining formatting and formulas from preceding line
- Next by Date: How to make #NA appear blank?
- Previous by thread: Why does this simple Sub fail?
- Next by thread: Re: Why does this simple Sub fail?
- Index(es):