Show an Excel Data Validation Warning Only When No Is Selected
Question details
Show a confirmation when a user selects No from a Yes/No list, without displaying an alert for Yes.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A worksheet has a Required column with a data validation list containing Yes and No.
- Observed behavior
- Excel's standard data validation alert cannot display a conditional confirmation for one valid list item while allowing the other without an alert.
Identify the cells containing the Yes/No list and use desktop Excel, which can run VBA worksheet events. You will need to save the workbook as a macro-enabled .xlsm file and enable trusted macros when prompted.
Use a Worksheet Change Event to Confirm No Selections
Use VBA to show a confirmation for a single-cell change to No and undo the change if the user chooses not to proceed.
A data validation error alert is intended for invalid entries, not for confirming one valid item in a list. A worksheet event can check the selected value instead.
Select the Required cells, then open Data > Data Validation. On the Settings tab, confirm that Allow is set to List and that the source contains Yes and No.
Right-click the worksheet tab and select View Code. Insert the following code in that worksheet's code window, replacing B2:B100 with the actual Required range: Private Sub Worksheet_Change(ByVal Target As Range) If Target.CountLarge > 1 Then Exit Sub If Intersect(Target, Me.Range("B2:B100")) Is Nothing Then Exit Sub If IsError(Target.Value) Then Exit Sub If LCase$(Trim$(CStr(Target.Value))) = "no" Then If MsgBox("Are you sure you want to select No?", vbYesNo + vbExclamation) = vbNo Then On Error GoTo CleanUp Application.EnableEvents = False Application.Undo CleanUp: Application.EnableEvents = True End If End If End Sub
Use File > Save As and choose Excel Macro-Enabled Workbook (*.xlsm). Enable the macro if prompted, then select No in a monitored cell and choose No in the confirmation to undo the selection. Select Yes to confirm that no message appears.

Work With Yes/No Spreadsheets in WPS Office
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and support for common Excel formats, making it easy to move everyday workbook tasks between suites. It does not fix Excel's VBA event behavior; test macro-dependent workflows separately before migrating them.

Frequently Asked Questions
Can Excel's data validation alert warn for No but not Yes?
Not when both are valid items in the same list. Use a Worksheet_Change VBA event to check for No and display a confirmation.
Where do I paste the VBA code?
In desktop Excel, right-click the tab of the worksheet containing the list and select View Code. Paste the event code into that worksheet's code window.
How do I change which cells trigger the warning?
Replace B2:B100 in Me.Range("B2:B100") with the range containing your Required cells.
Why does the warning not appear in Excel for the web?
Excel for the web cannot run VBA macros. Open the .xlsm workbook in desktop Excel and enable trusted macros to use the worksheet event.
Will the code warn when several cells are pasted at once?
No. The example exits when more than one cell changes, so bulk pastes require a different approach.




