In my sheet PREQUEST, can you change this to a Yes No message and add other…
- User
In my sheet PREQUEST, can you change this to a Yes No message and add other requirements: Private Sub Worksheet_Activate() Call Module58.ListFilesInNotepad Application.Wait (Now + TimeValue("0:00:01")) MsgBox "If there is a PENDING QUOTE for this Request" & vbCrLf & _ "the Purchase Request must be started from QUOTES" & vbCrLf & vbCrLf & _ "If there is NO PENDING QUOTE for this Rrequest" & vbCrLf & _ "the Purchase Request will be recorded to QUOTES", vbInformation, "NEW PREQUEST"
When YES is clicked, exit the sub and activate the sheet QUOTES
There is also a similar message in the Private Sub Worksheet_Activate event of the QUOTES sheet. Is there a way of passing the responce over to the sheet QUOTES so that it does activate its own pop up message.
I will also apply your change to the QUOTES sheet so that if I answer YES and activate the PREQUEST sheet, the pop up in the PREQUEST sheet is not activated.
- Assistant
Private Sub Worksheet_Activate() Call Module58.ListFilesInNotepad Application.Wait (Now + TimeValue("0:00:01"))
Dim response As VbMsgBoxResult response = MsgBox("Is there a PENDING QUOTE for this Request?" & vbCrLf & _ "If YES, the Purchase Request must be started from QUOTES." & vbCrLf & vbCrLf & _ "If NO, the Purchase Request will be recorded to QUOTES.", vbQuestion + vbYesNo, "NEW PREQUEST") If response = vbYes Then Sheets("QUOTES").Activate Exit Sub End IfEnd Sub
In the QUOTES sheet's Worksheet_Activate event, you can pass the response using a public variable like this:
Public responseFromPREQUEST As VbMsgBoxResult
Private Sub Worksheet_Activate() MsgBox "This is the QUOTES sheet."
If responseFromPREQUEST = vbYes Then MsgBox "Response from PREQUEST was YES." End If responseFromPREQUEST = vbNoEnd Sub
Make sure to update the QUOTES sheet's Worksheet_Deactivate event to reset the responseFromPREQUEST variable.