Hello,
I am looking to stop a MsgBox from appearing more than one time, once the if statement is true. Currently I have If 3 cells are filled in, a message box appears with instructions on what to do next - however, if the user clicks on other cells within the spreadsheet the message box keeps appearing with every cell the user clicks on, because the 3 cells in the If statement are still true.
How would I get the MsgBox to only appear that one time when all 3 specific cells are filled in and not appear when the user filled in those 3 cells and is now clicking around and filling in other cells?
Here is the code that I have. I originally had it under Private Sub Worksheet_SelectionChange(ByVal Target As Range) but then moved it to its own sub.
Sub tMsgBox()
Dim Answer As VbMsgBoxResult
If (Range("A9") = "Crime Victims Bank Account") And (Range("G18") = "Yes") And IsEmpty(Range("J18").Value) = False Then
Sheets("CVCP Pick-Up Form").Visible = True
Answer = MsgBox("You have indicated that you have checks being held for pick-up. Please select the tab, CVCP Pick-Up Form, at the bottom to complete and print the CVCP Check Pick-Up Form." & VBA.Constants.vbNewLine & _
VBA.Constants.vbNewLine & "Thank You!" & VBA.Constants.vbNewLine & VBA.Constants.vbNewLine & _
"Would you like to proceed directly to the CVCP Check Pick-Up Form?", vbYesNo, "Check(s) Held for Pick-Up")
End If
If Answer = vbYes Then
MsgBox "Yay!" 'This will be changed to take the user to a other tab/sheet automatically that is now visible for them to complete the form.
Else
Exit Sub 'This would be to keep them on the current sheet/form
End If
End Sub
I am looking to stop a MsgBox from appearing more than one time, once the if statement is true. Currently I have If 3 cells are filled in, a message box appears with instructions on what to do next - however, if the user clicks on other cells within the spreadsheet the message box keeps appearing with every cell the user clicks on, because the 3 cells in the If statement are still true.
How would I get the MsgBox to only appear that one time when all 3 specific cells are filled in and not appear when the user filled in those 3 cells and is now clicking around and filling in other cells?
Here is the code that I have. I originally had it under Private Sub Worksheet_SelectionChange(ByVal Target As Range) but then moved it to its own sub.
Sub tMsgBox()
Dim Answer As VbMsgBoxResult
If (Range("A9") = "Crime Victims Bank Account") And (Range("G18") = "Yes") And IsEmpty(Range("J18").Value) = False Then
Sheets("CVCP Pick-Up Form").Visible = True
Answer = MsgBox("You have indicated that you have checks being held for pick-up. Please select the tab, CVCP Pick-Up Form, at the bottom to complete and print the CVCP Check Pick-Up Form." & VBA.Constants.vbNewLine & _
VBA.Constants.vbNewLine & "Thank You!" & VBA.Constants.vbNewLine & VBA.Constants.vbNewLine & _
"Would you like to proceed directly to the CVCP Check Pick-Up Form?", vbYesNo, "Check(s) Held for Pick-Up")
End If
If Answer = vbYes Then
MsgBox "Yay!" 'This will be changed to take the user to a other tab/sheet automatically that is now visible for them to complete the form.
Else
Exit Sub 'This would be to keep them on the current sheet/form
End If
End Sub