+ Reply to Thread
Results 1 to 28 of 28

Cannot create listbox column more than 10

  1. #1
    Forum Contributor ebin charles's Avatar
    Join Date
    03-31-2010
    Location
    Dammam, Saudi Arabia
    MS-Off Ver
    Microsoft Excel 2010
    Posts
    255

    Cannot create listbox column more than 10

    Hello,

    I am using excel userform to maintain client receivable.
    I created report which will be in Listbox. When I use macro it search for
    the client and show report in Listbox.

    But my list box does not showing more than 10 column.
    I cannot use column heads = true and "Rowsource". like this method.

    B'cause that doesn't works for my macro. Any way I need
    to add more than 10 column. Please I find difficult.

    Can anyone please help me.

    charles
    Attached Files Attached Files
    Last edited by ebin charles; 06-27-2011 at 03:00 AM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Cannot create listbox column more than 10

    Hello ebin charles,

    A VBA ListBox will not display more than 10 columns of data unless you link the ListBox to Range using the "RowSource" property. Can you explain more about why you can not use this method in your macro?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Contributor ebin charles's Avatar
    Join Date
    03-31-2010
    Location
    Dammam, Saudi Arabia
    MS-Off Ver
    Microsoft Excel 2010
    Posts
    255

    Re: Cannot create listbox column more than 10

    Quote Originally Posted by Leith Ross View Post
    Hello ebin charles,

    A VBA ListBox will not display more than 10 columns of data unless you link the ListBox to Range using the "RowSource" property. Can you explain more about why you can not use this method in your macro?
    Because when I apply this method, all the data which comes under the RowSource will load automatically when userform initialize. But I create report based on some criteria.

    Criteria like my Client and their Project/Service/Agewise and so on. Is there any other possible way to select report with criteria under above method.

    please help me.

    charles

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Cannot create listbox column more than 10

    Hi charles

    Filter the data then populate the ListBox.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  5. #5
    Forum Contributor ebin charles's Avatar
    Join Date
    03-31-2010
    Location
    Dammam, Saudi Arabia
    MS-Off Ver
    Microsoft Excel 2010
    Posts
    255

    Re: Cannot create listbox column more than 10

    Quote Originally Posted by jaslake View Post
    Hi charles

    Filter the data then populate the ListBox.
    Dose not matter of filter, but the no of column will be the same.
    By filtering you can reduce no of rows but not column.

    Charles

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Cannot create listbox column more than 10

    Hi Charles

    Tis true
    By filtering you can reduce no of rows but not column.
    I think Mr Ross is correct. Please explain more explicitly what you're trying to do.

  7. #7
    Forum Contributor ebin charles's Avatar
    Join Date
    03-31-2010
    Location
    Dammam, Saudi Arabia
    MS-Off Ver
    Microsoft Excel 2010
    Posts
    255

    Re: Cannot create listbox column more than 10

    Quote Originally Posted by jaslake View Post
    Hi Charles

    Tis true

    I think Mr Ross is correct. Please explain more explicitly what you're trying to do.

    It's ok but I do not much idea in vba.
    I am just learning.

    If someone helps me it'll be well and good.
    or give idea to do such.

    charles

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Cannot create listbox column more than 10

    Hello Charles,

    The only other solution I can offer you is to use a ListView object instead of the ListBox. This will overcome the columns limitation and also provide you with extra features not available with with a ListBox. I have attached a sample workbook so you can see what it looks like.
    Attached Files Attached Files

  9. #9
    Forum Contributor ebin charles's Avatar
    Join Date
    03-31-2010
    Location
    Dammam, Saudi Arabia
    MS-Off Ver
    Microsoft Excel 2010
    Posts
    255

    Re: Cannot create listbox column more than 10

    Quote Originally Posted by Leith Ross View Post
    Hello Charles,

    The only other solution I can offer you is to use a ListView object instead of the ListBox. This will overcome the columns limitation and also provide you with extra features not available with with a ListBox. I have attached a sample workbook so you can see what it looks like.
    Thank you so much. But can I get total for certain column.
    you have given me example file, in that can I get total for amount column?

    Much better for me If it is ok,
    please help me.

    charles


    And I have more than four macro function in "Listbox", can I apply same in "ListView"?
    I got success for first macro to get the total for column by this code:

    Please Login or Register  to view this content.
    By the same time when I click the list it need to load in textbox for edit.
    Is it possible?

    charles
    Last edited by ebin charles; 06-26-2011 at 12:30 AM.

  10. #10
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Cannot create listbox column more than 10

    Hello Charles,

    I will work on converting the ListBox code to work with the ListView. Yes, a total row can be added in.

  11. #11
    Forum Contributor ebin charles's Avatar
    Join Date
    03-31-2010
    Location
    Dammam, Saudi Arabia
    MS-Off Ver
    Microsoft Excel 2010
    Posts
    255

    Re: Cannot create listbox column more than 10

    Quote Originally Posted by Leith Ross View Post
    Hello Charles,

    I will work on converting the ListBox code to work with the ListView. Yes, a total row can be added in.
    Thank you so much.
    I can learn much of vba from excel forum. Thank you.

    Charles

  12. #12
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434

    Re: Cannot create listbox column more than 10

    If you populate the listbox with a variant array the column limit can be over-ridden.

    http://www.vbaexpress.com/forum/arch...p/t-15038.html


    Your issue then becomes creating a variant array from the filtered data.
    Cheers
    Andy
    www.andypope.info

  13. #13
    Forum Contributor ebin charles's Avatar
    Join Date
    03-31-2010
    Location
    Dammam, Saudi Arabia
    MS-Off Ver
    Microsoft Excel 2010
    Posts
    255

    Re: Cannot create listbox column more than 10

    Quote Originally Posted by Andy Pope View Post
    If you populate the listbox with a variant array the column limit can be over-ridden.

    http://www.vbaexpress.com/forum/arch...p/t-15038.html


    Your issue then becomes creating a variant array from the filtered data.
    Thank you very much.

    Then please show me to have filtering with variant array.
    so that I modify my own code.

    charles

  14. #14
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434

    Re: Cannot create listbox column more than 10

    This should get you started.

    Please Login or Register  to view this content.

  15. #15
    Forum Contributor ebin charles's Avatar
    Join Date
    03-31-2010
    Location
    Dammam, Saudi Arabia
    MS-Off Ver
    Microsoft Excel 2010
    Posts
    255

    Re: Cannot create listbox column more than 10

    Quote Originally Posted by Andy Pope View Post
    This should get you started.

    Please Login or Register  to view this content.

    Thank you so much.

    As Leith Ross said, Is it possible in ListView.?

    Charles

  16. #16
    Forum Contributor ebin charles's Avatar
    Join Date
    03-31-2010
    Location
    Dammam, Saudi Arabia
    MS-Off Ver
    Microsoft Excel 2010
    Posts
    255

    Re: Cannot create listbox column more than 10

    In your code how to avoid column no 1.
    Because I already choose name in top Box1.

    In previous code I used, I can choose column from sheet to display in listbox . (B1, C1, D1, E1, ---, G1)
    Is there option to choose column in your code?

    Charles
    Last edited by ebin charles; 06-26-2011 at 12:15 PM.

  17. #17
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Cannot create listbox column more than 10

    try here
    Please Login or Register  to view this content.
    Last edited by john55; 06-26-2011 at 12:37 PM.
    Regards, John55
    If you have issues with Code I've provided, I appreciate your feedback.
    In the event Code provided resolves your issue, please mark your Thread as SOLVED.
    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

    ...enjoy -funny parrots-

  18. #18
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Cannot create listbox column more than 10

    Hello Charles,

    I was out and about with my family today. Here is the modified workbook. It has the macro and the ListView object added to it. The Grand Total line appears below the last amount in bold text.
    Attached Files Attached Files

  19. #19
    Forum Contributor ebin charles's Avatar
    Join Date
    03-31-2010
    Location
    Dammam, Saudi Arabia
    MS-Off Ver
    Microsoft Excel 2010
    Posts
    255

    Re: Cannot create listbox column more than 10

    Quote Originally Posted by Leith Ross View Post
    Hello Charles,

    I was out and about with my family today. Here is the modified workbook. It has the macro and the ListView object added to it. The Grand Total line appears below the last amount in bold text.
    Thank you so much.

    But I find difficult in filtering Client & project wise.

    Is it working for you?

    charles

  20. #20
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Cannot create listbox column more than 10

    Hello Charles,

    If by "Client" you mean the "List" column, I have no problems with the data being filtered or not filtered. What problem are you experiencing?

  21. #21
    Forum Contributor ebin charles's Avatar
    Join Date
    03-31-2010
    Location
    Dammam, Saudi Arabia
    MS-Off Ver
    Microsoft Excel 2010
    Posts
    255

    Re: Cannot create listbox column more than 10

    Quote Originally Posted by Leith Ross View Post
    Hello Charles,

    If by "Client" you mean the "List" column, I have no problems with the data being filtered or not filtered. What problem are you experiencing?
    I need to filter by Client wise as "Box1" value,
    at the same time Project wise as "Box2" value.

    I need "Saudi Arabian Saipem" clietn with "Qassim" project entry.

    Is it possible?

    Charles

  22. #22
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Cannot create listbox column more than 10

    Hello Charles,

    I made the changes to the filtering. Have a look at this workbook and let me know what you think.
    Attached Files Attached Files

  23. #23
    Forum Contributor ebin charles's Avatar
    Join Date
    03-31-2010
    Location
    Dammam, Saudi Arabia
    MS-Off Ver
    Microsoft Excel 2010
    Posts
    255

    Re: Cannot create listbox column more than 10

    Quote Originally Posted by Leith Ross View Post
    Hello Charles,

    I made the changes to the filtering. Have a look at this workbook and let me know what you think.
    Thank you SO MUCH.

    What I need to say?. NO Words to say.
    You might have solved more tougher than this code.
    But for me this solution meant, you are really great.Genius.

    When I select a entry in List view, will it display in below textboxs so that I can edit
    the entry and save back.

    Charles

  24. #24
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Cannot create listbox column more than 10

    Hello Charles,

    I meant to ask you which Text Boxes need to be filled in. Can you show me a list of the Text Boxes to fill in?

  25. #25
    Forum Contributor ebin charles's Avatar
    Join Date
    03-31-2010
    Location
    Dammam, Saudi Arabia
    MS-Off Ver
    Microsoft Excel 2010
    Posts
    255

    Re: Cannot create listbox column more than 10

    I have textboxs just below "ListView". I need to load the certain details in below TextBoxs when I click ListView.
    So that I can edit and save back.

    Charles
    Attached Files Attached Files

  26. #26
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Cannot create listbox column more than 10

    Hello Charles,

    I used the Text Boxes that were listed in the ListBox_Click event. The only problem I had was I could not find a PO number listed anywhere. That Text Box is blank. Check this workbook and let me know what needs to be updated.
    Attached Files Attached Files

  27. #27
    Forum Contributor ebin charles's Avatar
    Join Date
    03-31-2010
    Location
    Dammam, Saudi Arabia
    MS-Off Ver
    Microsoft Excel 2010
    Posts
    255

    Re: Cannot create listbox column more than 10

    Honorable Leith Ross,

    I bow my head before vba Legend, LEITH ROSS.
    You have reached the highest.
    There's lots to say....

    Than you MASTER. Have a good day.

    Regards
    Charles

  28. #28
    Registered User
    Join Date
    02-21-2013
    Location
    Baku
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Cannot create listbox column more than 10

    i have listdox and use add.item method why i cannot add.item UserForm1.ListBox1.List(r - 1, 10) = UserForm1.Label49.Caption

+ 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