Consulting

Results 1 to 4 of 4

Thread: Auto Fill into Text Box / cell

  1. #1
    VBAX Regular
    Joined
    Aug 2008
    Posts
    46
    Location

    Auto Fill into Text Box / cell

    Hi Guys

    I know this is virtually impossible

    but couldn't help wondering

    Is it possible to have an autofill option in a Normal cell or text box ( not combo or list box) ?

    Thanks

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    If you are talking about an ActiveX textbox, then someting like this could work
     
    Private Sub TextBox1_Change()
    test
    End Sub
     
    Sub test()
    Select Case TextBox1.Text
        Case "a"
            TextBox1.Text = "all text entered"
        Case "b"
            TextBox1.Text = "better text entered"
    End Select
    End Sub
    For a cell, you would need to run a Change event after data is entered, so you could use a list of abreviations, similar to above. These cannot be checked though, as each letter is entered.
    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'

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    I would suggest a slight alternative using Malcolm's basic idea

    Private Sub TextBox1_AfterUpdate()
        With TextBox1
        Select Case True
            Case "all text entered" Like .Text & "*"
                .Text = "all text entered"
            Case "better text entered" Like .Text & "*"
                .Text = "better text entered"
        End Select
        End With
    End Sub
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  4. #4
    VBAX Regular
    Joined
    Aug 2008
    Posts
    46
    Location
    Thank you

Posting Permissions

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