I am running some code that works fine when I click on yes in the message box. However I want to Exit Sub after answering no and the other message box comming up. I have tried numerous approaches but as a newbie I don't know the answer. Please help!
Mark


Private Sub JournalReg_Click()
Dim ThisFile As Workbook
Set ThisFile = ThisWorkbook
Dim Sht As Worksheet
Dim answer As String
Dim JnlReg As String
 
    For Each Sht In ThisWorkbook.Worksheets
    Sht.Unprotect
    Next Sht
    
    Sheets("Jnl Vouch").Select
    
    If Company.text = "" Then
    MsgBox "You must enter a Company"
    Exit Sub
    End If
    
    Range("rngCo") = Company.text
    Range("rngEntry") = EntryDate
    Range("rng_pdate") = PostingDate
    
    ThisFile.Activate
    ActiveSheet.Calculate
    JnlReg = Range("rngFile_JnlReg").Value
    Workbooks.Open Filename:=JnlReg
    
    Dim JournReg As Workbook
    Set JournReg = Workbooks.Open(Filename:=JnlReg)
   
    ActiveSheet.Unprotect Password:="p"
    Range("A65536").End(xlUp).Offset(1, 12).Select
    
    answer = MsgBox("The next JV Ref is " & Selection & ". Do you want to use this JV Ref?", vbYesNo, "Confirm Action")
    If answer = vbNo Then MsgBox ("You pressed No button, Please put the Journal Number in the Box")
    
    If answer = vbYes Then JournReg.ActiveSheet.Range("A65536").End(xlUp).Offset(1, 12).Copy Destination:=ThisFile.ActiveSheet.Range("rngJourn_Nos")
    ThisFile.Activate
    ActiveSheet.Calculate
    Range("rngJnlRegPaste").Copy
    Range("P5").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ThisFile.ActiveSheet.Range("rngJnlRegPaste").Copy Destination:=JournReg.ActiveSheet.Range("A65536").End(xlUp)
'    .Offset(1, 0)
    JournReg.Activate
    ActiveSheet.Protect Password:="p"
    MsgBox ("Journal information has now been posted to the Journal Register")
    JournReg.Activate
    ActiveWorkbook.Save
    ActiveWorkbook.Close
End Sub