Conditional trigger of data validation list

Peter Harms

New Member
Joined
Jul 5, 2019
Messages
3
Hi there
My problem
1. Column A captures either "yes" or "No' from a data validation list
2. Column B Captures dates from a data validation list
If the response in column A is "No" then I want the date to equal the date in the cell above.
If the response is in column A is "Yes" then I want to trigger the data validation for the dates
Is this possible?
Many thanks
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Put the following code in the events of your sheet. Change the range "$G$1:$G$8" by the range where you have the dates for the validation list.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("A:A")) Is Nothing Then
        If Target.Count > 1 Then Exit Sub
        If LCase(Target.Value) = LCase("Yes") Then
            With Target.Offset(0, 1).Validation
                .Delete
                .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
                    xlBetween, Formula1:="=[COLOR=#ff0000]$G$1:$G$8[/COLOR]"
                .IgnoreBlank = True
                .InCellDropdown = True
                .InputTitle = ""
                .ErrorTitle = ""
                .InputMessage = ""
                .ErrorMessage = ""
                .ShowInput = True
                .ShowError = True
            End With
        ElseIf LCase(Target.Value) = LCase("No") Then
            If Target.Row > 1 Then
                If Target.Offset(-1, 1) <> "" Then
                    Target.Offset(0, 1) = Target.Offset(-1, 1)
                End If
            End If
        End If
    End If
End Sub

SHEET EVENT

Right click the tab of the sheet you want this to work, select view code and paste the code into the window that opens up.
 
Upvote 0
Hi Peter,

Without using VBA, This can be achieved by putting putting a below formula in Data Validation:

Code:
=IF(A3="No",B2,INDIRECT(A3))

where Yes is the Defined Name of the conditional dates for choosing option "Yes". In this Case if you choose "No" the drop-down will only show the value from above.


Book1
AB
1ResponseDate
2Yes7/5/2019
3No7/5/2019
4No7/5/2019
5Yes7/9/2019
6No7/9/2019
Sheet5



Book1
J
1Yes
27/5/2019
37/6/2019
47/7/2019
57/8/2019
67/9/2019
77/10/2019
87/11/2019
97/12/2019
107/13/2019
117/14/2019
127/15/2019
137/16/2019
Sheet5
 
Upvote 0

Forum statistics

Threads
1,216,120
Messages
6,128,948
Members
449,480
Latest member
yesitisasport

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top