VBA宏根据用户响应询问问题

时间:2019-06-26 13:49:11

标签: excel vba

我当前正在开发一个程序,该程序基于特定的原因,宏会根据用户的响应向用户询问某些问题,例如,方案是否为“收入中断”,并且用户对某个问题的回答为“是”问一个特定的问题,如果他们单击“否”,它将提出另一个问题。我遇到的问题是我不确定如何使它在多个场景中都能正常工作。我想我已经将它用于其中一个,但是还必须有5个其他方案。任何帮助表示赞赏!

谢谢

我目前正在使用精选案例。

Sub ShortTerm()
Dim Ret_type As Integer
Dim that As Variant
Ret_type = MsgBox("Are you receiving EI or other source of funds?", vbYesNoCancel)
Select Case Ret_type
Case 6  'if yes
    that = MsgBox("Are funds readily accessible?", vbYesNoCancel)
     Select Case that
    Case 6  'if yes
            that = MsgBox("Can you make payment arrangements today?", vbYesNoCancel)
            Select Case that
            Case 6 'if yes
            that = MsgBox("Can you make payment  today?", vbYesNoCancel)
            Case 7 'if no
            that = MsgBox("Can you make payments before next due date?", vbYesNoCancel)
            Case 2 'if cancel
            MsgBox "Sure"
            End Select
    'MsgBox "Reason for arrears?"
Case 7  'if no
    that = MsgBox("Template Recommends: Waive Payments, Cards Hardship, Loan/RCL RAP'S")
    End Select
    Select Case that
    Case 6  'if yes
            that = MsgBox("Can you make payment arrangements today?", vbYesNoCancel)
    Case 7  'if no
        that = MsgBox("Collector Documents on CACS", vbYesNoCancel)
    Case 2  'if cancel
        MsgBox "You clicked 'CANCEL' button."
    End Select
     'MsgBox "Can you make a payment arrangement?"
Case 2  'if cancel
    MsgBox "You clicked 'CANCEL' button."

End Select
End Sub

0 个答案:

没有答案