Results 1 to 6 of 6

Thread: display the results from range of columns when combobox is selected

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2013
    Posts
    10

    display the results from range of columns when combobox is selected

    Hello,

    I am attaching a spreadsheet, where column A values are selected in a combobox, the corresponding values in the country range gets i.e from Column B to Column S gets populated in listbox.

    For example when user selects Yacht gloss in combobox, then its value 8605.668 gets displayed in listbox and its column header Netherlands gets displayed in a textbox

    How can I do this in vba? please help.
    Attached Files Attached Files

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: display the results from range of columns when combobox is selected

    probably need to use the listindex of the combobox to return the row containing the data, else use vlookup or find to return the value of cells in the same row /column
    as i can not open your workbook i can suggest working code
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2013
    Posts
    10

    Re: display the results from range of columns when combobox is selected

    Hi westconn1,

    can you please suggest a sample code, which based on 4 columns makes a simple search in worksheet and shows the results in the listbox. the 4 column selection will come from 4 different comboboxs.. can you suggest a simple code, as I am new to vba dont know where to start with

    thanks in advance for the reply

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: display the results from range of columns when combobox is selected

    save your sample as .xls and reattach, as i can not open later versions, i will then have a look
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2013
    Posts
    10

    Re: display the results from range of columns when combobox is selected

    I have managed to code the above requirement, but when real time data is added,through excel sheets with about 37k records, it takes about 7 to 10 minutes to populate the details, although its just doing normal filter criteria and populating the results.is their any way to increase the performance of the userform?

  6. #6

    Thread Starter
    New Member
    Join Date
    Mar 2013
    Posts
    10

    Re: display the results from range of columns when combobox is selected

    I am attaching the form code as text along with this email, can you please look at it and tell me why its taking so much time to populate the results. Could you kindly improve the performance , by replacing anything in this code , by a different way?
    Attached Files Attached Files

Posting Permissions

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



Click Here to Expand Forum to Full Width