Below is the code I'm currently using the problem is it will only look for the uppercase of the word. This is in a Userform Textbox called reason. Basically what I would like to happen if the user types in any of these terms that will be on sheet1 column AA, a message box appears, if none of the words are present the contents are copied to the clipboard. Please Help.
Code:
Private Sub reason_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If (reason.Value) = "ACETAMINOPHEN/CODEINE" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "ADDERALL*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "ALPRAZOLAM*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "XANAX*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "BUTORPHANOL*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "STADOL*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "CARISOPRODOL*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "SOMA*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "CHLORAL HYDRATE*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "CHLORDIAZEPOXIDE*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "LIBRIUM*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "CLONAZEPAM*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "KLONOPIN*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "CLORAZEPATE*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "TRANXENE*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "CODEINE*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "DEXMETHYLPHENIDATE*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "FOCALIN*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "DEXTROAMPHETAMINE*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "DIAZEPAM*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "VALIUM*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "ESZOPICLONE*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "LUNESTA*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "FENTANYL*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "DURAGESIC*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "FIORINAL*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "GUAIFENESIN W/CODEINE*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "HYDROCODONE*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "HYDROMORPHONE*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "DILAUDID*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "LISDEXAMFETAMINE*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "VYNASE*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "LORAZEPAM*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "ATIVAN*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "LORTAB*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "MEPERIDINE*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "DEMEROL*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "METHADONE*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "METHYLPHENIDATE*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "CONCERTA*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "METHYLPHENIDATE*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "DAYTRANA*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "METHYLPHENIDATE*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "RITALIN*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "MODAFINIL*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "PROVIGIL*" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "MORPHINE" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "OXAZEPAM" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "SERAX" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "OXYCODONE" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "PERCOCET" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "PHENOBARBITAL" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "PREGABALIN" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "LYRICA" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "SUBOXONE" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "TEMAZEPAM" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "RESTORIL" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "TRAMADOL" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "ULTRAM" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "TRIAZOLAM" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "HALCION" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "ZOLPIDEM" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
If (reason.Value) = "AMBIEN" Then MsgBox ("Please notify patient that the medication they are asking for may require them to have an appointment. Please check with local SOP to ensure the medication can be asked for via Telephone Consult")
End Sub
Last edited: