+ Reply to Thread
Results 1 to 27 of 27

Populate text boxes on user form, from combo box on same user form

  1. #1
    Registered User
    Join Date
    06-11-2016
    Location
    Corpus Christi, Texas
    MS-Off Ver
    2013
    Posts
    34

    Populate text boxes on user form, from combo box on same user form

    I have built a user form with a combo box, which I have the data sheet named Estimator, but I want it to populate other text boxes on the same user form when a selection is made from the combo box on the user form. I am seeking the assistance to getting the code started on the user form. I am very new to VB and am learning from tutorials and what assistance I can get from this forum. I don't completely understand how to Dim as Long, Integer, or String or what the difference is when starting to code the forms. As I said, I am that new to coding, but I am able to build the user forms just fine. I'm wanting someone to explain to me how to start the coding and help me to learn.

  2. #2
    Forum Contributor kalbasiatka's Avatar
    Join Date
    02-27-2016
    Location
    Brest, Belarus
    MS-Off Ver
    2021
    Posts
    224

    Re: Populate text boxes on user form, from combo box on same user form

    Hi! Show your file and write that does not work.
    To do it for me and help me it is 2 different things!
    Sorry for my english, blame Google translator

  3. #3
    Registered User
    Join Date
    06-11-2016
    Location
    Corpus Christi, Texas
    MS-Off Ver
    2013
    Posts
    34

    Re: Populate text boxes on user form, from combo box on same user form

    I will attach the file, thank you for assistance. I actually have no code at all in the form. That is my issue, I don't have enough experience to understand getting the code to start properly. I don't have a clear understanding of using the Dim factor. I will answer questions as clearly as I can.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    06-11-2016
    Location
    Corpus Christi, Texas
    MS-Off Ver
    2013
    Posts
    34

    Re: Populate text boxes on user form, from combo box on same user form

    I want to learn this. I would like for someone to get this started for me, then I believe that with what I have learned thus far, I can work on it myself. To get it to my starting place, I want to be able to select a size from the combo box and have it coded to fill the 4-hour minimum and the mobilization text boxes automatically. I may need help with the rest of it, but I at least want to learn how to do it myself. I don't want someone to do the entire project for me, just help me get it started. There will be nothing to be added to the sheet itself. The user form being filled out will be the objective, as it is an estimating sheet, to get an estimate of a job. Make sense?
    Last edited by Richardswaim; 06-25-2016 at 06:11 PM. Reason: Add desired info.

  5. #5
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Populate text boxes on user form, from combo box on same user form

    I'll get you started with one way of doing it.
    Removed RowSource of SizeCombobox to load in different way. Changed columncount of same combobox to 9 columns and then loaded entire used range into SizeCombobox.
    From there on you load other textboxes by selecting value in SizeCombobox
    Attached Files Attached Files
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  6. #6
    Registered User
    Join Date
    06-11-2016
    Location
    Corpus Christi, Texas
    MS-Off Ver
    2013
    Posts
    34

    Re: Populate text boxes on user form, from combo box on same user form

    Thank you bakerman2, I have not seen that way before, although there must be more than one way of doing things in VB, as I am learning. How do I get the value of PumpedTextBox to be multiplied by the value of
    Please Login or Register  to view this content.
    and the value entered into YardageTextBox? YardageTextBox is just to the left of PumpedTextBox.

    Can I use the code you applied to SizeComboBox, and get it to apply to the AddComboBoxes in the Additional Charges section? I want to be able to select an additional charge item, and then multiply the associated value, times the AddTextBox values, and get a sum in the AddChargeTextBox. Do you mind helping me with these Combo Boxes as well? If you would help me with one, I can get the other 3. By seeing how you do the first (Yardage Boxes in the first question), I will be able to study your coding and figure out what you're doing and learn from your style. The same with the AdditionalChargeComboBoxes coding.

    Once again, thank you for your assistance and guidance, I am learning more than you can imagine.

  7. #7
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Populate text boxes on user form, from combo box on same user form

    I've put the calculation of some fields under Get Info-button so you have an idea on how to proceed.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    06-11-2016
    Location
    Corpus Christi, Texas
    MS-Off Ver
    2013
    Posts
    34

    Re: Populate text boxes on user form, from combo box on same user form

    Alright, I have everything with SizeComboBox figured out and working, thank you so much. I am trying to get the AdditionalComboBox items to work. Do I place a With code line just like you did with SizeComboBox to get them to work?

  9. #9
    Registered User
    Join Date
    06-11-2016
    Location
    Corpus Christi, Texas
    MS-Off Ver
    2013
    Posts
    34

    Re: Populate text boxes on user form, from combo box on same user form

    bakerman2, I have changed a couple of things that I'm not sure how to make the necessary changes in the code. How did you specify the list for AddComboBox? I didn't need Overtime in that range, since I had it on the top portion of the form. I also don't need a couple more of those items on the list. I have narrowed that list to just 4 items. Can you assist me? I will post the worksheet again with the changes I have made, so you can see where I am at, if you want me too.

  10. #10
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Populate text boxes on user form, from combo box on same user form

    Check it out now (made some adjustments to loading additional comboboxes)
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    06-11-2016
    Location
    Corpus Christi, Texas
    MS-Off Ver
    2013
    Posts
    34

    Re: Populate text boxes on user form, from combo box on same user form

    Here is what I have done. Do you mind applying your changes and looking at it to make the adjustments to what I changed?
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    06-11-2016
    Location
    Corpus Christi, Texas
    MS-Off Ver
    2013
    Posts
    34

    Re: Populate text boxes on user form, from combo box on same user form

    OK, I see what you did, I will work with that and get back to you. But, if you have already done it, thank you!

  13. #13
    Registered User
    Join Date
    06-11-2016
    Location
    Corpus Christi, Texas
    MS-Off Ver
    2013
    Posts
    34

    Re: Populate text boxes on user form, from combo box on same user form

    bakerman2, I messed up the list when I took out the unnecessary data. How do I get that corrected on the sheet I sent you?

  14. #14
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Populate text boxes on user form, from combo box on same user form

    So far so good.
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    06-11-2016
    Location
    Corpus Christi, Texas
    MS-Off Ver
    2013
    Posts
    34

    Re: Populate text boxes on user form, from combo box on same user form

    Ok, yes we're getting there, thank you so, so much. When I select AddComboBox2, the value doesn't come up. I added the code as:

    Please Login or Register  to view this content.
    But the price isn't coming up in the AddChargeTextBox2.Text cell. What did I do wrong?

  16. #16
    Registered User
    Join Date
    06-11-2016
    Location
    Corpus Christi, Texas
    MS-Off Ver
    2013
    Posts
    34

    Re: Populate text boxes on user form, from combo box on same user form

    Sorry, I got it!

  17. #17
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Populate text boxes on user form, from combo box on same user form

    You have to make a seperate Change-event for every AddCombobox.
    You can copy the first on I've made and change the number for every combobox.
    Please Login or Register  to view this content.
    and so on.

  18. #18
    Registered User
    Join Date
    06-11-2016
    Location
    Corpus Christi, Texas
    MS-Off Ver
    2013
    Posts
    34

    Re: Populate text boxes on user form, from combo box on same user form

    Yes sir, I did that, thank you. If I don't make a selection in AddComboBox's, I am getting an error. How do I put an ">0" statement in to stop the error? I am having to enter a "0" in some of the fields to get it to go on.

    In the permittextbox, for the BSA120, I have to put a zero in that box, or it errors on me. There are several boxes like that. ?

  19. #19
    Registered User
    Join Date
    06-11-2016
    Location
    Corpus Christi, Texas
    MS-Off Ver
    2013
    Posts
    34

    Re: Populate text boxes on user form, from combo box on same user form

    I got it,
    Please Login or Register  to view this content.
    .

    You have done so, so, so much to help bakerman2, I thank you from the bottom of my heart.

  20. #20
    Registered User
    Join Date
    06-11-2016
    Location
    Corpus Christi, Texas
    MS-Off Ver
    2013
    Posts
    34

    Re: Populate text boxes on user form, from combo box on same user form

    bakerman2, is there room for me to add more lines in the AddComboBox fields, in case I need to items? So, it will populate the combo boxes and adjoined boxes, like with the prices of such, or did you only allow for the current 4 entries?

  21. #21
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Populate text boxes on user form, from combo box on same user form

    Since we use this line
    Please Login or Register  to view this content.
    You can expand downwards as far as you want with only 1 condition that you don't allow empty rows in between.

  22. #22
    Registered User
    Join Date
    06-11-2016
    Location
    Corpus Christi, Texas
    MS-Off Ver
    2013
    Posts
    34

    Re: Populate text boxes on user form, from combo box on same user form

    Alright, you the man, thank you again for all you have done for me. Till next time, good bye!

  23. #23
    Registered User
    Join Date
    06-11-2016
    Location
    Corpus Christi, Texas
    MS-Off Ver
    2013
    Posts
    34

    Re: Populate text boxes on user form, from combo box on same user form

    bakerman2, I have a need to add another combobox to my userform. This combobox will reference another column at the end of the list you created for the SizeComboBox. You had the list for nine rows, I added one to it, to make ten. There is a value in these cells that I want to reference with the additional combobox I have added. How do I expand the "sn" list without messing up what I already have?

  24. #24
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Populate text boxes on user form, from combo box on same user form

    Best thing to do is post new file with new Combobox and extra data you want to add.

  25. #25
    Registered User
    Join Date
    06-11-2016
    Location
    Corpus Christi, Texas
    MS-Off Ver
    2013
    Posts
    34

    Re: Populate text boxes on user form, from combo box on same user form

    Thank you bakerman2. I have added a few things, as you will see. I am learning, slowly, but learning. I have added the combobox "Service Type". I added the data to Column J and populated it accordingly. In the combobox, I have added "residential" and "industrial". I need the value of "minimum" to reflect the values of Column E when residential is selected, and the values of Column J when industial is selected. I want a msg box to come up when neither are selected to prompt the user to make one of the selections before picking from anything else on the form.

    Like I said, I am learning, I have been through many tutorials to learn this, but haven't seen any to do what I am wanting to do. Your assistance is greatly appreciated. I will be here to answer any questions you may have.
    Attached Files Attached Files

  26. #26
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Populate text boxes on user form, from combo box on same user form

    Try this one.
    Attached Files Attached Files

  27. #27
    Registered User
    Join Date
    06-11-2016
    Location
    Corpus Christi, Texas
    MS-Off Ver
    2013
    Posts
    34

    Re: Populate text boxes on user form, from combo box on same user form

    Well, that will work. Can you tell me how you were able to do this? Did you create a dynamic range for the additional data? Sorry to bother you with this, but I want to learn and your explanation will be a great help for me. Thank you for the time you have spent to help me.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Can't get combo box in user form to populate
    By KDrew in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-14-2015, 07:09 PM
  2. textbox dependent on 2 combo boxes (user form) VBA
    By njpete in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-21-2014, 09:59 AM
  3. [SOLVED] Cascading user form combo boxes?
    By ciapul12 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-10-2014, 03:20 PM
  4. populating list boxes and combo boxes in a user form.
    By ahceinaej in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-10-2014, 11:54 AM
  5. User Form with with Populating Combo Boxes
    By Maneesh Massey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-23-2013, 04:46 AM
  6. Cascading Combo Boxes in User Form
    By CRIMEDOG in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-02-2009, 10:44 PM
  7. [SOLVED] Excel User form with 4 Combo Boxes
    By ca1358 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-16-2006, 03:10 PM

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