OK. I figured out something like this.
Dynamic range for drowdown list with 1 additional empty line at bottom (to give user possibility put number outside validation list)
If this 'typed' value does not exist already is added at the bottom and automatically appear at second click in cell on drop down list.
1. VBA into particular sheet:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim lastRow As Long
lastRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
If Not Intersect(Target, Range("C1")) Is Nothing Then
With ActiveSheet.Range("A1:A30")
Set c = .Find(Target, LookIn:=xlValues)
If Not c Is Nothing Then
Exit Sub
Else
Range("A" & lastRow + 1) = Target.Value
End If
End With
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim lastRow As Long
lastRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
If Not Intersect(Target, Range("C1")) Is Nothing Then
With [C1].Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=list"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End If
End Sub
2. dynamic range to create A1:A30 called 'list'
3. drodown in cell C1
and should works
file attached.
Bookmarks