Auto-complete entries in inputboxes

I have some vba code that prompts the user of Excel spreadsheets for various data items needed to complete tasks on the particular spreadsheet. I have not been able to come up with a way of auto-completing the entries once enough characters are entered to make them unique based upon a range of data entries that I already have available.

If anyone can help I would appreciate it.




Answer this question

Auto-complete entries in inputboxes

  • droujav

    Hello Pat,

    If you have a Range named "Names", say A1:A10 filled with names (any data). The following should do what you need.

    Any problems, feel free to write again.

    Chas

    Private Sub TextBox1_Change()

    Dim testStr As String
    Dim foundAdress
    Range("Names").Select
    For Each cell In Range("Names")
    testStr = UCase(TextBox1.Value)
    If testStr = UCase(Left(cell.Value, Len(testStr))) Then
    found = found + 1
    foundaddress = cell.Address
    End If
    Next
    If found = 1 Then
    TextBox1.Value = Range(foundaddress).Value
    End If
    End Sub


  • Auto-complete entries in inputboxes