MsgBox and VbYesNo not working for Exit Sub argument

  • The "Yes" and "No" Button MsgBox are both calling my given Sub "Overpaid_L_Grant" which means the Exit Sub is not working for "No". How can I click on the "No" button to exit Sub and "Yes" to just Call the Sub if the Sheets already exists?


  • Try changing the msgbox part of the code to:

    1. If Not ws Is Nothing Then
    2. answer = MsgBox("Overpaid_LGrant Already Exists, Do you want to process it again?", vbYesNo + vbInformation)
    3. If answer = vbYes Then
    4. Call Overpaid_L_grant
    5. Else
    6. Exit Sub
    7. End If
    8. End If
  • gijsmo, I changed the code with your code above but the problem is the same.... Attached is the example when you run "Overpaid L_Grant Exists" vba for your view

    Appreciates your reply