vendredi 2 octobre 2020

How to use <> in an if statement in VBA (Input box)

in an input box I am trying to allow the user to only input certain text, in this case weekly, monthly, quarterly, semiannually, or annually. It seems fairly easily but I just don't know where I am going wrong.

Thank you for the help

Do
        Saving_frequency = InputBox("Please enter your savings frequency.")
        If Saving_frequency <> "weekly" or "monthly" or "quarterly" or "semiannually" or "annually" Then
        MsgBox ("Must be weekly, monthly, quarterly, semiannually, or annually .")
        End If
    Loop While Saving_frequency <> weekly" or "monthly" or "quarterly" or "semiannually" or "annually"

Aucun commentaire:

Enregistrer un commentaire