Consulting

Results 1 to 6 of 6

Thread: Solved: Autocomplete cells

  1. #1
    VBAX Regular
    Joined
    Sep 2008
    Posts
    28
    Location

    Solved: Autocomplete cells

    Hi again !

    Is it possible to autocomplete the first few letters that I type and match an existing entry in another worksheet ?

    E.g. Sheet 1 Col A Row 1 = Ano which would automatically complete the text from Sheet 2 Col A Row 1 = Another

    Thank you

  2. #2
    VBAX Tutor nst1107's Avatar
    Joined
    Nov 2008
    Location
    Monticello
    Posts
    245
    Location

  3. #3
    VBAX Regular
    Joined
    Sep 2008
    Posts
    28
    Location
    Thank you nst1107 !

    Problem solved.

  4. #4

    Auto complete from list on another sheet

    I have a list of 40 unique names in column A, a1:a40, on Sheet1.

    I want cells in columns B and D on Sheet2 to auto-complete as the user types based on the choices in column A on Sheet 1.

    I do not want to use a dropdown list because I do not want users to see what the choices of names are.

    The kb entry below is EXACTLY what I need, but for some reason the sample spreadsheet attached to it is not working for me, nor is the code that is provided. (This is my first post so it will not let me post a link - the URL is below.) Any help would be appreciated! Great forum!

  5. #5
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi Christine,
    Welcome to VBAX.
    I had no problem with the KB Item. Check your Macro Security settings.

    In any case, I found "Enter" after each letter a nuisance. Try this simple Userform alternative.

    Option Explicit
    Option Compare Text
    Private Sub TextBox1_Change()
    Dim i As Long
    Dim cel As Range
    Dim MyStr As String
    i = 0
    For Each cel In Range("Data")
       If cel Like TextBox1 & "*" Then
          i = i + 1
          MyStr = cel
       End If
    Next
    Label1.Caption = i
    If i = 1 Then
       ActiveCell = MyStr
       Unload UserForm1
    End If
    If i = 0 Then MsgBox "Name not found"
    End Sub
     
    Private Sub CommandButton1_Click()
    ActiveCell = Application.WorksheetFunction.Proper(TextBox1)
    Unload UserForm1
    End Sub
    Last edited by Aussiebear; 03-26-2023 at 11:18 AM. Reason: Adjusted the code tags
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  6. #6
    Excellent! Thanks for the help and the quick response. This is a much improved version. CJ

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •