+ Reply to Thread
Results 1 to 2 of 2

Performance: Find value in a ListColumn vs. Find key in a User-Defined Collection in VBA

Hybrid View

  1. #1
    Registered User
    Join Date
    06-10-2012
    Location
    Bay Area, California
    MS-Off Ver
    Excel 2016
    Posts
    28

    Question Performance: Find value in a ListColumn vs. Find key in a User-Defined Collection in VBA

    I have a User-Defined VBA function that needs to repeateadly find the Row index position of a specific value in a ListColumn.

    I've tried using the Range/Find function to return the matching cell index row within the DataBodyRange of the ListColumn, and also created a Custom Collection, which I filled with the ListColumn cell values as Keys, adding each item in same order as the ListRow indexes.

    Right now, the workbook only has limited rows, and either method seems to perform quickly, but I'm wondering if anyone knows if there's a speed penalty for using Range/Find vs. just referencing a Collection item by its key for massively-repeated calls and over several thousands of rows.

    Is there yet a faster way to do this?

    Thank You!

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Performance: Find value in a ListColumn vs. Find key in a User-Defined Collection in V

    Calls to the Worksheet from code are slow and should be done sparingly. So a collection would seem a better option as operations would be done within memory, I generally stick sheet data into arrays, work on that then write it back even for small amounts

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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