+ Reply to Thread
Results 1 to 8 of 8

Selected data from combo boxes to text boxes

  1. #1
    Registered User
    Join Date
    08-21-2013
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    11

    Selected data from combo boxes to text boxes

    Hi all

    First of all I would say I'm new to excel vba and know very little about it. Most of the macros I've ever used were copied and adapted by me.

    I've got a following problem.

    I have a table with some data, where "A","B" and "C" columns are more and more detailed description of a place. For example, "A1" = Europe, "B1" = England, "C1" = London.
    "D" column is a value (expenses in this particular place for a period of time). There are a significant amount of rows with different places (up to 200 yet)

    I've got 3 combo boxes with an available list of choices in the second and third depending on the choices in the previous ones. For example, if choose "Europe" in the first one, I can choose "France" or "England" etc. and then if I choose "England" I can go for "London", "Manchester" etc. Moreover, this data may repeat a few times. For example, there might be 5 "Europe" "England" "London" across the rows. The only difference will be in the value in "D" Column. I can continue these cascading combo boxes so I'm able to see all the values for a particular place across the rows. I've found a following code for that and adapted it a bit

    Please Login or Register  to view this content.
    However, I wonder if it's possible to use a Text Box instead of the fourth Combo Box, so I could see all the values and not choose them. More over, I wonder If it's possible to show the values in the Text Box for the places, if 3rd and even 2nd combo boxes are not chosen (To see all the values for the "Europe" or "England", without choosing a particular city).

    Thank you so much much for your help in advance
    Hope it's not too onerous.
    Last edited by soulun; 08-21-2013 at 04:05 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Selected data from combo boxes to text boxes

    something like,

    for each itm in d.items
    s=s & itm & " "
    next itm

    textbox1.text =s

    havent tested
    Last edited by nathansav; 08-21-2013 at 09:42 AM.
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Selected data from combo boxes to text boxes

    soulun,

    Please use code tags when posting code. It maintains VBA formatting and makes posts easier to read.

    To add code tags:
    Click the 'Edit Post' link at the bottom of your post, highlight the code and press the # button in the toolbar.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  4. #4
    Registered User
    Join Date
    08-21-2013
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Selected data from combo boxes to text boxes

    sorry ^_^ tried to find it but unsuccessfully. Fixed it now

  5. #5
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Selected data from combo boxes to text boxes

    I would use a listbox. Everytime a value is chosen in a combobox you can use
    Please Login or Register  to view this content.
    Where comboboxY is the combobox the selection is taking place.

    If you attach your workbook as an example, I can be more specific.

    To attach a workbook, press the 'Go Advanced' button below and use the paperclip in the toolbar to navigate to your workbook.

  6. #6
    Registered User
    Join Date
    08-21-2013
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Selected data from combo boxes to text boxes

    Here it is.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    08-21-2013
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Selected data from combo boxes to text boxes

    nathansav,

    this works for the 3 combo box (instead of the fourth combo box I have the Text Box). Will try to adapt it for the others. Thank you so much.

    Decided to use the listbox, as it splits the values into the rows itself
    Last edited by soulun; 08-22-2013 at 03:11 AM.

  8. #8
    Registered User
    Join Date
    08-21-2013
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Selected data from combo boxes to text boxes

    Ive solved this.

    Here is the code if somebody wants.

    Please Login or Register  to view this content.
    Now trying to find out how to allow choosing the second combobox if the first one is not chosen.

+ 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] Help with code for userform text boxes, combo boxes and excel
    By innerise in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-20-2014, 09:07 AM
  2. I need a code for presence check to check multiple text boxes and combo boxes
    By Lee_wwfc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-24-2013, 01:53 PM
  3. Combo Boxes / Text Boxes Not Updating
    By ckk403 in forum Excel General
    Replies: 4
    Last Post: 01-09-2012, 08:22 AM
  4. assigning data to lists boxes and combo boxes in userforms
    By weston.roberts in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-01-2011, 03:11 AM
  5. assigning data to lists boxes and combo boxes in userforms
    By weston.roberts in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-30-2011, 08:46 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