View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default Can't get the macro to quit

hi
looks like you are caught in a endless loop.
sub auto_open calls sub daily which calls sub auto_open which calls sub
daily......
and on and on and on.......
why are we calling sub auto_open at the end of daily????????

regards
FSt1

"Carrie_Loos via OfficeKB.com" wrote:

This is perplexing.........I have three macro's (I removed all the 'work'
portion of the code to shorten it) but basically, If I follow the path of
auto_open, VbNo then Beginning_Week, vbYes, I get to the macro Daily but when
I get to the bottom of the sub Daily, it doesn't end. For some reason it
jumps to other End Sub's code line and then starts executing lines of code
again. I have tried many different configurations without success.

Any ideas? I wasn't aware that "End Sub" would not end the code execution???!!
! Help and many thanks.

Carrie


Option Explicit
Sub auto_open()
Dim ans As Long

' If user answers yes then follow code below if user answers no then envoke
macro asking if it is the beginning of the week
ans = MsgBox("Is this the end of the Week?", vbYesNo)
If ans = vbNo Then Call Begin_Week


' Saves Ending Inventory Balance then envokes macro for Daily Input
Call Daily


End Sub

Sub Begin_Week()
Dim ans As Long

' If user answers yes then follow code below if user answers no then envoke
macro for Daily Input
ans = MsgBox("Is this the beginning of the Week?", vbYesNo)
If ans = vbNo Then Call Daily

' Clear contents of all Data Entry Sections

' Copy Ending Inventory from Last week to new worksheet

' Save Changes

' Envoke Macro for Daily Input
Call Daily

End Sub

Sub Daily()
Dim ans As Long

' If user answers yes then follow code below if user answers no then envoke
macro for Daily Input
ans = MsgBox(Prompt:="Ready for Daily Input?", Buttons:=vbYesNo)
If ans = vbNo Then
Call auto_open
End If

€˜Begin Input
End Sub

--
Message posted via http://www.officekb.com