LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Exit Sub not exiting

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 oSheet.Range(conCellOrderToVerify) < "" And _
InStr(oSheet.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
ActiveSheet.Range("A11").Select
Application.ScreenUpdating = True
Exit Sub
<snip
End Sub

--
Judy Hopkins
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exit Field vs Exit Button...... roy_ware Excel Programming 2 October 10th 07 04:05 PM
exiting the whole macro tigoda Excel Programming 9 October 1st 07 03:34 PM
Exiting Worksheet Evan Excel Discussion (Misc queries) 1 February 11th 05 06:06 PM
If a called sub exit, how to the caller exit right away? luvgreen[_4_] Excel Programming 4 February 24th 04 05:06 PM
Exiting a workbook Dick Kusleika Excel Programming 0 August 15th 03 05:30 PM


All times are GMT +1. The time now is 05:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"