+ Reply to Thread
Results 1 to 9 of 9

Formatting of listbox columns - 10000+ rows, without slowing the runtime

  1. #1
    Forum Contributor
    Join Date
    08-20-2019
    Location
    Mumbai
    MS-Off Ver
    Office 365
    Posts
    101

    Formatting of listbox columns - 10000+ rows, without slowing the runtime

    I have a listbox that is getting populated with transaction data: 10000+ rows and 25 columns

    I had the below code to format 6 of the list columns. But that slows down the process drastically as well as gives some other problem(switches the screen from userform to the sheet). When I comment out this code the process runs faster and the other problem disappears.

    Please Login or Register  to view this content.

    How do I achieve the formatting of listbox columns without the above loop?


    To give you some more details: The list box gets filled as follows:
    I use Advanced filter copy method on a main data table and paste the filtered data (with exactly same columns) in another sheet
    Then I add the filtered data to the array. The code is given below.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Formatting of listbox columns - 10000+ rows, without slowing the runtime

    Why bother with formatting?

    Use Row 0 as a Headline, Put your formatting information there,
    Select Row 0 and it will be highlighted Blue.

    Then you can load your Listbox using:

    Please Login or Register  to view this content.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Contributor
    Join Date
    08-20-2019
    Location
    Mumbai
    MS-Off Ver
    Office 365
    Posts
    101

    Re: Formatting of listbox columns - 10000+ rows, without slowing the runtime

    Thanks mehmetcik for your reply.

    I do not know how to use this method : "Use Row 0 as a Headline, Put your formatting information there, Select Row 0 and it will be highlighted Blue."
    Please give some more info on this.

    Also the code given by you: Me.lbCustLog.Range("A5").CurrentRegion - this gives error.
    Isn't .range("A5").CurrentRegion a property of worksheet and not a listbox?
    Please guide me know if I missed anything here.

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Formatting of listbox columns - 10000+ rows, without slowing the runtime

    Try this sample.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Formatting of listbox columns - 10000+ rows, without slowing the runtime

    Instead of looping through the list box, changing entries, loop through the loading array, vSL, before
    Please Login or Register  to view this content.
    . That will be faster.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  6. #6
    Forum Contributor
    Join Date
    08-20-2019
    Location
    Mumbai
    MS-Off Ver
    Office 365
    Posts
    101

    Re: Formatting of listbox columns - 10000+ rows, without slowing the runtime

    Thanks mehmetcik. Now I understand what you meant by put formating info in Heading row(0). However, that's not what I want. I really needed to format the listcolumns related to amounts and dates as per the local date formats. Thanks for your help.

  7. #7
    Forum Contributor
    Join Date
    08-20-2019
    Location
    Mumbai
    MS-Off Ver
    Office 365
    Posts
    101

    Re: Formatting of listbox columns - 10000+ rows, without slowing the runtime

    Thanks Mike. I looped thru the array and formatted the required elements, and it was really fast.

    Second question: How do I format the columns displaying amounts as right aligned. As of now the list columns with numbers are formatted with below code and they appear left aligned.

    vSL(i, LServFeeCol) = Format(vSL(i, LServFeeCol), "#,##0")

  8. #8
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Formatting of listbox columns - 10000+ rows, without slowing the runtime

    The rows and columns of a listbox are all formatted the same (alignment, font, bold, etc.)

    Re-reading your question, you have over 10,000 entries in the listbox ?!?
    That's a huge hassle for a human to choose one entry from over 10,000. Why are you using a listbox for this? It would be better for the 10,000 entries to be left in cells until whatever filtering is applied.

  9. #9
    Forum Contributor
    Join Date
    08-20-2019
    Location
    Mumbai
    MS-Off Ver
    Office 365
    Posts
    101

    Re: Formatting of listbox columns - 10000+ rows, without slowing the runtime

    Thanks for taking time to look at the point of 10,000+ rows in listbox. I will explain the process. So far its working well. Pls let me know if I can improve the process.

    The transaction data is stored in a sheet table - 10,000+ rows. It gets populated in an array(main Array) first by assigning DataBodyRange of the table and then in the listbox.

    On top of the list box I have a few comboboxes which act as filters for this data. Like Customer name, Service Category, Service Code, DueMonth, and so on. Everytime a combobox value changes(the user applies one or more filter), I use advanced filtercopy method and paste the filtered table in another sheet. That filtered table is then stored in another array(Filtered Array) and it populates the listbox. A user will typically apply 2-3 filters and the number of items in listbox will reduce to 10 - 100. In fact it can reduce to even 1 if correct filters are applied. I found this(Adv filtercopy) to be the fastest method to lookup the original data table and bring in filtered data in listbox.

    The reason for two arrays: The first array is used for the top section of the userform where I display yearly transaction summary values. The filtered array is used to populate listbox based on combobox values.

    Once the user gets hold of the relevant entries - by applying correct filters, necessary actions can be taken for those entries - like assign an executive, update status, generate invoice, etc. At that point I write back the updates to the original data table and refresh both the arrays.

    Do let me know if I can improve this process.

+ 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. Big conditional formatting formula slowing down file, need help to rewrite
    By henkisdabro in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-21-2014, 01:27 AM
  2. [SOLVED] Formatting of data output from listbox rows
    By AndyE in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-25-2013, 05:08 PM
  3. Have 2500 pdfs w/ 10000 pgs total. Need 2 columns: 1. pdf id # 2. overall page #
    By chagok in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-14-2012, 03:09 PM
  4. Conditional Formatting Is Really Slowing Down My Computer, Any Suggestions?
    By Orangeworker in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-10-2010, 03:28 PM
  5. [SOLVED] how insert same text in empty cells in column (10000 rows)
    By bromptongadgets in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-11-2005, 11:15 AM
  6. Replies: 4
    Last Post: 10-12-2005, 02:05 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