Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub Main
Dim int As Integer int = myFunction End Sub Function myFunction Dim i As Integer i = InputBox If i9 then Exit Sub 'I want to stop execution of SubMain too! myFunction = i End Function If i9 I want to not only Exit Sub for myFunction but stop SubMain too. How do I do that? Thanks, Art |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If i9 then End
The End command stops all macro processing. Mike F "ArthurJ" wrote in message ... Sub Main Dim int As Integer int = myFunction End Sub Function myFunction Dim i As Integer i = InputBox If i9 then Exit Sub 'I want to stop execution of SubMain too! myFunction = i End Function If i9 I want to not only Exit Sub for myFunction but stop SubMain too. How do I do that? Thanks, Art |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Art,
Just pass something back to your calling sub from the called routine, informing you to stop SubMain. This could be by sending a ByRef arg to the called function, but in your example you could do this. Sub Main Dim int As Integer int = myFunction If int 9 then Exit Sub 'do more stuff End Sub Function myFunction Dim i As Integer i = InputBox myFunction = i if i 9 then Exit Function ' do more stuff End Function Never use the "End" statement to stop all code running. Regards, Peter T "ArthurJ" wrote in message ... Sub Main Dim int As Integer int = myFunction End Sub Function myFunction Dim i As Integer i = InputBox If i9 then Exit Sub 'I want to stop execution of SubMain too! myFunction = i End Function If i9 I want to not only Exit Sub for myFunction but stop SubMain too. How do I do that? Thanks, Art |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Why does code execution stop? HELP! | Excel Programming | |||
Stop execution of ThisWorkBook Code | Excel Programming | |||
stop execution | Excel Programming | |||
stop code execution with button | Excel Programming | |||
stop code execution | Excel Programming |