Hi all,
I've got a piece of code that takes the user entered responses in a message box to do a set number of things.
I want it to work in a way that if the user clicks no the sheet shuts down and no further code is run. If the user clicks yes I want the code to continue.
As it stands, my code shuts down the document irrespective of what is selected by the user. I understand that this is because the shutting down of the workbook happens outside the If statement, but I don’t know how to correct this so that it does what I would like it to do.
It looks like this at the moment:
Public Opt as Variant
Sub Check()
Dim response As Variant
Dim message As String
Sheets("Front Page").select
If Range("A2") = 1 then Opt = "1"
If Range("A2") = 2 then Opt = "2"
MESSAGE = "YOU CHAVE CHOSEN OPTION "& APPROACH & "IS THIS RIGHT?"
response = msgbox(MESSAGE, vbYesNo)
if response = vbNo then
Application.DisplayAlerts = False
Workbooks("SHEET1.xlsm").Close
Application.DisplayAlerts = True
Exit Sub
If Response = vbYes then Sheets("Summary").Select
End Sub
Any help would be greatly appreciated.
Thanks
Bookmarks