+ Reply to Thread
Results 1 to 4 of 4

Auto Populate a Form Text Box?

Hybrid View

  1. #1
    Registered User
    Join Date
    06-07-2011
    Location
    Winston Salem , NC
    MS-Off Ver
    Excel 2003
    Posts
    2

    Auto Populate a Form Text Box?

    Hi,
    Don't know if this is possible but want to give it a shot. So i have a form that is filled out with a Name, Date, Amount, and a Code. When you press submit it puts the data in columns A, B, C, & D. And continues to do the same on the next row as you enter more of the same data. So the question is, am I able to have the form pre-populate a name or code that has already been used? Example would be how excel gives you the rest of a name if you enter the first letter after its already been used once before. I wanted to see if this could be used in the form I created? Any thoughts?
    Here is the code I have for my Submit Button on the form:

    Private Sub CommandButton1_Click()

    Columns("A").End(xlDown).Select

    ActiveCell.Offset(1, 0).Value = TextBox1.Text

    ActiveCell.Offset(1, 1).Value = TextBox2.Text

    ActiveCell.Offset(1, 2).Value = TextBox3.Text

    ActiveCell.Offset(1, 3).Value = TextBox4.Text

    Unload UserForm1
    UserForm1.Show


    End Sub

    Thanks So Much!
    Jason

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,281

    Re: Auto Populate a Form Text Box?

    Hi Jason25 and welcome to the forum,

    It seems to me you are looking for the functionality of a ComboBox instead of a TextBox. Instead of having a TextBox on your form change it to a ComboBox and then point the rowsource to a list of unique values in your Column A.

    See http://www.contextures.com/xlDataVal14.html
    or http://www.learnexcel.org/blog/learn...ombobox-lists/
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    06-07-2011
    Location
    Winston Salem , NC
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Auto Populate a Form Text Box?

    Hey Marvin,
    Thanks for the response. If I use a ComboBox instead of a TextBox wont I only be able to have the name field restricted to the names I have it pointed to like a list? Or will it auto populate the ComboBox after the data is submitted. My concern is that this excel sheet is used to break down data and is then deleted and new data for new names is entered so there wont be specific names or codes used over and over.. does that make sense? Sorry if this is confusing..

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,281

    Re: Auto Populate a Form Text Box?

    If you use a ComboBox on a Userform you don't have to use only the names that drop down. You can type in a completely new word/name. You will need VBA code to handle what values show up in the combobox.

    I'd suggest looking at the RowSource of you combobox data being a named range. Perhaps even a dynamic named range where you keep your ever-changing list.

    See http://www.vertex42.com/ExcelArticle...ed-ranges.html

    hope this helps.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1