I have a multi option Message box, that has a main box, & a sub message box. The Main box has the standard Yes/No responses. The Yes goes to the sub box, & the NO is supposed to go back to the previous worksheet. However it is going to the sub worksheet. The problem I am having with the sub box is that it is going to the last option & not stopping at the chosen selection. The other problem is if you choose Cancel, it does not go back to the original worksheet that you were on.
The code shown below is from Google, & pieces that I have used elsewhere.
I know I am missing something, But I don't know what, & have not found an answer on Google.
The code shown below is from Google, & pieces that I have used elsewhere.
Code:
Sub Walk_In_Training_Data_Entry_Quarter1_Quarter2()
Dim MyValue As Integer
'MsgBox prompt:="Continue to Walk In Training Data Entry?", Title:="Referral Workbook Data Entry"
i = MsgBox("Continue to Walk In Training Data Entry 1st Quarter?", vbYesNo, "Referral Workbook Data Entry")
'First message shows in the body of the box, message 2 shows at the top of the box.
MyValue = InputBox("Only Click Ok or Cancel after your Selection!!!!!!!" & vbCrLf & _
"Enter 1 for October" & vbCrLf & _
"Enter 2 for November" & vbCrLf & _
"Enter 3 for December", "Walk In Training Data Entry")
Do
If (MyValue = 1) Or (MyValue = 2) Or (MyValue = 3) Then
Exit Do
Else
MsgBox "You have not made a valid entry. Please try again."
End If
Loop
'Code to Execute When Condition = value_1
Select Case Condition
Case value_1
If ActiveSheet.CodeName = "Sheet52" Then
' The message below only shows when you are on the active sheet.
MsgBox "You are already on October Walk In Training Data Entry!", vbInformation
Else
Sheets("WI_OT_1ST").Activate
Range("A1").Select
End If
End Select
Select Case Ans
Case Else
End Select
'Code to Execute When Condition = value_2
Select Case Condition
Case value_2
If ActiveSheet.CodeName = "Sheet53" Then
' The message below only shows when you are on the active sheet.
MsgBox "You are already on October Walk In Training Data Entry!", vbInformation
Else
Sheets("WI_NT_1ST").Activate
Range("A1").Select
End If
End Select
Select Case Ans
End Select
'Code to Execute When Condition = value_3
Select Case Condition
Case value_2
If ActiveSheet.CodeName = "Sheet54" Then
' The message below only shows when you are on the active sheet.
MsgBox "You are already on December Walk In Training Data Entry!", vbInformation
Else
Sheets("WI_DT_1ST").Activate
Range("A1").Select
End If
End Select
Select Case Ans
End Select
End Sub