Re: Exit Sub not exiting
- From: "Tim Zych" <tzych@NOSp@mE@RTHLINKDOTNET>
- Date: Fri, 23 Nov 2007 22:42:21 -0800
What happens if ExitSub is the only cmdLoadData_Click event code, removing
all other code as a test? Does it still run repeatedly?
--
Tim Zych
SF, CA
"JHop" <JHop@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:3E595CB8-80AC-4AF5-89AD-8A19A45A73A0@xxxxxxxxxxxxxxxx
Thanks, Leith, but I have stepped through it numerous times and there are
no
other events that trigger it. When I step through it, I see it go from
Exit
Sub at the end to cmdDataLoad_Click and go through the whole thing again.
Very weird. Is there such a thing as corruption in Excel VBA?
--
Judy Hopkins
"Leith Ross" wrote:
On Nov 23, 6:12 pm, JHop <J...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
I have a very strange problem. When the following code executes and
the
condition is not met, it goes to LoadDataExit as expected, but then
instead
of stopping when it gets to the end, it goes back to cmdLoadData and
executes
repeatedly. This happened once before in another workbook, and at the
time
(being more of an Access programmer) I decided it was some kind of
corruption
and went back to an earlier version and applied all the code changes,
which
got it working again. Since it's happened again in a totally different
workbook, and since that kind of fix is very tedious and not
necessarily
guaranteed to work, I'm wondering what could be happening and how best
to fix
it now and prevent it in the future. I'd appreciate any help.
Private Sub cmdLoadData_Click()
<snip>
If o***.Range(conCellOrderToVerify) <> "" And _
InStr(o***.Range(conCellOrderToVerify), "Order - Verify") = 0
Then
MsgBox "Input file in wrong format. Cell " &
conCellOrderToVerify & _
" on Sheet1 (Summary Sheet) " & _
" should contain the text 'Order - Verify'", _
vbCritical
oInputBook.Close
GoTo LoadDataExit
End If
<snip>
LoadDataExit:
Sheets("Start").Activate
Sheets("Data").Visible = False
Sheets("Lookups").Visible = False
Active***.Range("A11").Select
Application.ScreenUpdating = True
Exit Sub
<snip>
End Sub
--
Judy Hopkins
Hello Judy,
I would check any work*** event code you might have. A command
button can be "clicked' in code by setting its value property. You
could also add a break points to each line in LoadDataExit to step
through and verify your operations. To add/remove a break point, place
the cursor on the line and press F9. To step to the next statement,
press F5.
Sincerely,
Leith Ross
.
- Follow-Ups:
- Re: Exit Sub not exiting
- From: JHop
- Re: Exit Sub not exiting
- References:
- Re: Exit Sub not exiting
- From: Leith Ross
- Re: Exit Sub not exiting
- From: JHop
- Re: Exit Sub not exiting
- Prev by Date: Re: Excel 2000 User Forms & Macros - Will they work with Excel 2007
- Next by Date: Re: At a complete loss for lookup/delete...
- Previous by thread: Re: Exit Sub not exiting
- Next by thread: Re: Exit Sub not exiting
- Index(es):