RAJESH1960
Banned for repeated rules violations
- Joined
- Mar 26, 2020
- Messages
- 2,313
- Office Version
- 2019
- Platform
- Windows
Hello guys
I am facing a problem with the message box. When the first message box appears and if I press no, then it should stop the macro. But in this case, it is showing the message which is to be displayed at the end of the macro. Need your expertise to solve the mistake.
I am facing a problem with the message box. When the first message box appears and if I press no, then it should stop the macro. But in this case, it is showing the message which is to be displayed at the end of the macro. Need your expertise to solve the mistake.
Rich (BB code):
Sub TestMsgBox()
Dim Answer As VbMsgBoxResult
Answer = MsgBox("CHECK..." & vbNewLine & "1.VOUCHER TYPE & LEDGER NAME IS ENTERED", vbYesNo, "Run Macro")
If Answer = vbYes Then
Sheets("SalesData").Select
If Sheets("SalesData").Range("A2") = "" Then
MsgBox "Data Not Entered"
Exit Sub
End If
End If
Sheets("SalesData").Activate
Range("A2").Select
MsgBox ("Done.")
End Sub