ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Loop back to Case vbNo '#2 (https://www.excelbanter.com/excel-programming/394876-loop-back-case-vbno-2-a.html)

ryguy7272

Loop back to Case vbNo '#2
 
I am stuck on what I think is a loop, or may be some kind of function that
calls a certain part of the program. Basically, I am trying to figure out
how to move from Case vbNo '#3 to Case vbNo '#2. Below is my code. Can
anyone offer a suggestion as to how to get from #3 to #2? I'm thinking it is
a loop because if a user selects 'No' two times in a row, this sequence would
be looped through two times (although there is really no point in that, that
would be the logic).

YesNo = MsgBox("Has Firm been provided with, or been advised of the
existence of a legal opinion?", vbYesNo, "Warning")
Select Case YesNo
Case vbYes
'If answer is Yes, no additional action needs to be taken...
Unload UserForm47
UserForm49.Show
Case vbNo '#1
'Insert your code here if No is clicked
YesNo = MsgBox("Does the level of the opinion rise to a 'should
level'?", vbYesNo, "Warning")
Select Case YesNo
Case vbYes
MsgBox "The level of opinion is SHOULD LEVEL!!"

Case vbNo '#2
YesNo = MsgBox("You answered no. Are you sure?", vbYesNo,
"Warning")
Select Case YesNo

Case vbYes
UserForm55.Show
Unload UserForm47

Case vbNo €˜#3
'loop back to Case vbNo '#2...directly above...


End Select
End Select
End Select



Regards,
Ryan--

--
RyGuy

Bob Phillips

Loop back to Case vbNo '#2
 
Why? You should handle a separate MsgBox separately. You could get yourself
into a loop if they keep saying No otherwise.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"ryguy7272" wrote in message
...
I am stuck on what I think is a loop, or may be some kind of function that
calls a certain part of the program. Basically, I am trying to figure out
how to move from Case vbNo '#3 to Case vbNo '#2. Below is my code. Can
anyone offer a suggestion as to how to get from #3 to #2? I'm thinking it
is
a loop because if a user selects 'No' two times in a row, this sequence
would
be looped through two times (although there is really no point in that,
that
would be the logic).

YesNo = MsgBox("Has Firm been provided with, or been advised of the
existence of a legal opinion?", vbYesNo, "Warning")
Select Case YesNo
Case vbYes
'If answer is Yes, no additional action needs to be taken...
Unload UserForm47
UserForm49.Show
Case vbNo '#1
'Insert your code here if No is clicked
YesNo = MsgBox("Does the level of the opinion rise to a 'should
level'?", vbYesNo, "Warning")
Select Case YesNo
Case vbYes
MsgBox "The level of opinion is SHOULD LEVEL!!"

Case vbNo '#2
YesNo = MsgBox("You answered no. Are you sure?", vbYesNo,
"Warning")
Select Case YesNo

Case vbYes
UserForm55.Show
Unload UserForm47

Case vbNo '#3
'loop back to Case vbNo '#2...directly above...


End Select
End Select
End Select



Regards,
Ryan--

--
RyGuy




ryguy7272

Loop back to Case vbNo '#2
 
Bob, can you please show me how this should be done.
TIA!

--
RyGuy


"Bob Phillips" wrote:

Why? You should handle a separate MsgBox separately. You could get yourself
into a loop if they keep saying No otherwise.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"ryguy7272" wrote in message
...
I am stuck on what I think is a loop, or may be some kind of function that
calls a certain part of the program. Basically, I am trying to figure out
how to move from Case vbNo '#3 to Case vbNo '#2. Below is my code. Can
anyone offer a suggestion as to how to get from #3 to #2? I'm thinking it
is
a loop because if a user selects 'No' two times in a row, this sequence
would
be looped through two times (although there is really no point in that,
that
would be the logic).

YesNo = MsgBox("Has Firm been provided with, or been advised of the
existence of a legal opinion?", vbYesNo, "Warning")
Select Case YesNo
Case vbYes
'If answer is Yes, no additional action needs to be taken...
Unload UserForm47
UserForm49.Show
Case vbNo '#1
'Insert your code here if No is clicked
YesNo = MsgBox("Does the level of the opinion rise to a 'should
level'?", vbYesNo, "Warning")
Select Case YesNo
Case vbYes
MsgBox "The level of opinion is SHOULD LEVEL!!"

Case vbNo '#2
YesNo = MsgBox("You answered no. Are you sure?", vbYesNo,
"Warning")
Select Case YesNo

Case vbYes
UserForm55.Show
Unload UserForm47

Case vbNo '#3
'loop back to Case vbNo '#2...directly above...


End Select
End Select
End Select



Regards,
Ryan--

--
RyGuy





ryguy7272

Loop back to Case vbNo '#2
 
I don't necessarily think a 'No Loop' would be bad...it's not like the user
would enter a perpetual loop and lose control and then have to hit
Ctrl+Break. I think, at worst, a user may click the 'No' button on the
Message Box, a couple of times. I don't think anyone would continuously
click "No' over and over again, essentially saying, "I am not sure", "I am
not sure", "I am not sure"... Out of curiosity, could someone show me how
this would be done? Can someone show me how to move from Case vbNo '#3 to
Case vbNo '#2?

Regards,
Ryan---


"Bob Phillips" wrote:

Why? You should handle a separate MsgBox separately. You could get yourself
into a loop if they keep saying No otherwise.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"ryguy7272" wrote in message
...
I am stuck on what I think is a loop, or may be some kind of function that
calls a certain part of the program. Basically, I am trying to figure out
how to move from Case vbNo '#3 to Case vbNo '#2. Below is my code. Can
anyone offer a suggestion as to how to get from #3 to #2? I'm thinking it
is
a loop because if a user selects 'No' two times in a row, this sequence
would
be looped through two times (although there is really no point in that,
that
would be the logic).

YesNo = MsgBox("Has Firm been provided with, or been advised of the
existence of a legal opinion?", vbYesNo, "Warning")
Select Case YesNo
Case vbYes
'If answer is Yes, no additional action needs to be taken...
Unload UserForm47
UserForm49.Show
Case vbNo '#1
'Insert your code here if No is clicked
YesNo = MsgBox("Does the level of the opinion rise to a 'should
level'?", vbYesNo, "Warning")
Select Case YesNo
Case vbYes
MsgBox "The level of opinion is SHOULD LEVEL!!"

Case vbNo '#2
YesNo = MsgBox("You answered no. Are you sure?", vbYesNo,
"Warning")
Select Case YesNo

Case vbYes
UserForm55.Show
Unload UserForm47

Case vbNo '#3
'loop back to Case vbNo '#2...directly above...


End Select
End Select
End Select



Regards,
Ryan--

--
RyGuy





Susan

Loop back to Case vbNo '#2
 
imho, i would not use a case select structure here, because you're
only dealing with three (i think) very small commands. i think you'd
do better with a simple if then structure.

if message1 = vb yes then
go ahead & do your stuff
else
msgbox don't do that!
exit sub
end if

:)
susan


On Aug 6, 3:26 pm, ryguy7272
wrote:
I don't necessarily think a 'No Loop' would be bad...it's not like the user
would enter a perpetual loop and lose control and then have to hit
Ctrl+Break. I think, at worst, a user may click the 'No' button on the
Message Box, a couple of times. I don't think anyone would continuously
click "No' over and over again, essentially saying, "I am not sure", "I am
not sure", "I am not sure"... Out of curiosity, could someone show me how
this would be done? Can someone show me how to move from Case vbNo '#3 to
Case vbNo '#2?

Regards,
Ryan---



"Bob Phillips" wrote:
Why? You should handle a separate MsgBox separately. You could get yourself
into a loop if they keep saying No otherwise.


--
---
HTH


Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)


"ryguy7272" wrote in message
...
I am stuck on what I think is a loop, or may be some kind of function that
calls a certain part of the program. Basically, I am trying to figure out
how to move from Case vbNo '#3 to Case vbNo '#2. Below is my code. Can
anyone offer a suggestion as to how to get from #3 to #2? I'm thinking it
is
a loop because if a user selects 'No' two times in a row, this sequence
would
be looped through two times (although there is really no point in that,
that
would be the logic).


YesNo = MsgBox("Has Firm been provided with, or been advised of the
existence of a legal opinion?", vbYesNo, "Warning")
Select Case YesNo
Case vbYes
'If answer is Yes, no additional action needs to be taken...
Unload UserForm47
UserForm49.Show
Case vbNo '#1
'Insert your code here if No is clicked
YesNo = MsgBox("Does the level of the opinion rise to a 'should
level'?", vbYesNo, "Warning")
Select Case YesNo
Case vbYes
MsgBox "The level of opinion is SHOULD LEVEL!!"


Case vbNo '#2
YesNo = MsgBox("You answered no. Are you sure?", vbYesNo,
"Warning")
Select Case YesNo


Case vbYes
UserForm55.Show
Unload UserForm47


Case vbNo '#3
'loop back to Case vbNo '#2...directly above...


End Select
End Select
End Select


Regards,
Ryan--


--
RyGuy- Hide quoted text -


- Show quoted text -




ryguy7272

Loop back to Case vbNo '#2
 
Thanks for pointing me in that direction Susan. I went with this:

....blah, blah, blah...
Case vbNo '#3
MsgBox "You answered no. Please start again!!"
Exit Sub


Out of curiosity, can the thing I proposed be done? Can a msgbox be named
or somehow identified and then referenced in some sort of loop or sequence?

Cordially,
Ryan---


"Susan" wrote:

imho, i would not use a case select structure here, because you're
only dealing with three (i think) very small commands. i think you'd
do better with a simple if then structure.

if message1 = vb yes then
go ahead & do your stuff
else
msgbox don't do that!
exit sub
end if

:)
susan


On Aug 6, 3:26 pm, ryguy7272
wrote:
I don't necessarily think a 'No Loop' would be bad...it's not like the user
would enter a perpetual loop and lose control and then have to hit
Ctrl+Break. I think, at worst, a user may click the 'No' button on the
Message Box, a couple of times. I don't think anyone would continuously
click "No' over and over again, essentially saying, "I am not sure", "I am
not sure", "I am not sure"... Out of curiosity, could someone show me how
this would be done? Can someone show me how to move from Case vbNo '#3 to
Case vbNo '#2?

Regards,
Ryan---



"Bob Phillips" wrote:
Why? You should handle a separate MsgBox separately. You could get yourself
into a loop if they keep saying No otherwise.


--
---
HTH


Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)


"ryguy7272" wrote in message
...
I am stuck on what I think is a loop, or may be some kind of function that
calls a certain part of the program. Basically, I am trying to figure out
how to move from Case vbNo '#3 to Case vbNo '#2. Below is my code. Can
anyone offer a suggestion as to how to get from #3 to #2? I'm thinking it
is
a loop because if a user selects 'No' two times in a row, this sequence
would
be looped through two times (although there is really no point in that,
that
would be the logic).


YesNo = MsgBox("Has Firm been provided with, or been advised of the
existence of a legal opinion?", vbYesNo, "Warning")
Select Case YesNo
Case vbYes
'If answer is Yes, no additional action needs to be taken...
Unload UserForm47
UserForm49.Show
Case vbNo '#1
'Insert your code here if No is clicked
YesNo = MsgBox("Does the level of the opinion rise to a 'should
level'?", vbYesNo, "Warning")
Select Case YesNo
Case vbYes
MsgBox "The level of opinion is SHOULD LEVEL!!"


Case vbNo '#2
YesNo = MsgBox("You answered no. Are you sure?", vbYesNo,
"Warning")
Select Case YesNo


Case vbYes
UserForm55.Show
Unload UserForm47


Case vbNo '#3
'loop back to Case vbNo '#2...directly above...


End Select
End Select
End Select


Regards,
Ryan--


--
RyGuy- Hide quoted text -


- Show quoted text -





Susan

Loop back to Case vbNo '#2
 
i'm glad you got it working! i don't think what you proposed can be
done using microsoft messageboxes. however, you could easily do it
using USERFORMS that you have designed (very cleverly) to look exactly
like a microsoft messagebox. the userforms would be called in
sequence and would be numbered or named.
:)
i think i might try that (just as a test).
susan


On Aug 6, 4:54 pm, ryguy7272
wrote:
Thanks for pointing me in that direction Susan. I went with this:

...blah, blah, blah...
Case vbNo '#3
MsgBox "You answered no. Please start again!!"
Exit Sub

Out of curiosity, can the thing I proposed be done? Can a msgbox be named
or somehow identified and then referenced in some sort of loop or sequence?

Cordially,
Ryan---



"Susan" wrote:
imho, i would not use a case select structure here, because you're
only dealing with three (i think) very small commands. i think you'd
do better with a simple if then structure.


if message1 = vb yes then
go ahead & do your stuff
else
msgbox don't do that!
exit sub
end if


:)
susan

<snip


ryguy7272

Loop back to Case vbNo '#2
 
Ah! Very clever Susan!! This DG never ceases to amaze me. In fact, it is
only a rare occasion that I am amazed less than ten times per day by the
information posted here.


"Susan" wrote:

i'm glad you got it working! i don't think what you proposed can be
done using microsoft messageboxes. however, you could easily do it
using USERFORMS that you have designed (very cleverly) to look exactly
like a microsoft messagebox. the userforms would be called in
sequence and would be numbered or named.
:)
i think i might try that (just as a test).
susan


On Aug 6, 4:54 pm, ryguy7272
wrote:
Thanks for pointing me in that direction Susan. I went with this:

...blah, blah, blah...
Case vbNo '#3
MsgBox "You answered no. Please start again!!"
Exit Sub

Out of curiosity, can the thing I proposed be done? Can a msgbox be named
or somehow identified and then referenced in some sort of loop or sequence?

Cordially,
Ryan---



"Susan" wrote:
imho, i would not use a case select structure here, because you're
only dealing with three (i think) very small commands. i think you'd
do better with a simple if then structure.


if message1 = vb yes then
go ahead & do your stuff
else
msgbox don't do that!
exit sub
end if


:)
susan

<snip




All times are GMT +1. The time now is 06:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com