Originally Posted by
helpmeinexcel
Thanks so much! That worked wonderfully!
There is one issue though...
I need this data validation list to update every time it is clicked on (I put it in cell C10) or more specifically, if it helps, I need it to update when cells A10 or C7 change.
Do you know how to this/is it even possible?
You're welcome.
How do A10 or C7 change; by formula or by user input?
If it's by user input...- Right-click on the Sheet tab
- Select View Code from the pop up context menu
- Paste the code below in the worksheet's code module
The function VisibleModels can go in the worksheet's code module or it can stay in a standard code mode e.g. Module1.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(0, 0) = "A10" Or _
Target.Address(0, 0) = "C7" Then
With Range("C10").Validation
.Delete
.Add Type:=xlValidateList, Formula1:=VisibleModels(Range("A1:A20"))
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = False
.ShowError = False
End With
End If
End Sub
Function VisibleModels(Rng As Range) As String
Dim Cell As Range
For Each Cell In Rng
If Len(Cell) > 0 Then
VisibleModels = VisibleModels & Cell.Text & ","
End If
Next
VisibleModels = Left(VisibleModels, Len(VisibleModels) - 1)
End Function
Bookmarks