So I have a data validation in once cell that changes to one of three different named ranges based on a user selection in another cell. What I need is for when the user selects a certain value, i.e. "Selection A", the data validation will not only change to that corresponding named range, but will also display the first value within that range.
Currently I can manipulate the code to get the default value, however it keeps changing back to the default value every time I try and make a selection.Is this even possible? Below is my code that I'm currently running for once specific named range using a Worksheet_Change event
In this example I've used the named range selection_a
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("$E$3").Value = "Selection A" Then
With Range("L3:R4").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=selection_a"
.IgnoreBlank = False
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End If
With the default value showing and changing back constantly:
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("$E$3").Value = "Selection A" Then
Range("$L$3").Value = Sheets("sheet2").Range("$M$4").Value
With Range("L3:R4").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=selection_a"
.IgnoreBlank = False
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End If