+ Reply to Thread
Results 1 to 6 of 6

Help finding a tutorial/guide for searching VBA Arrays

  1. #1
    Registered User
    Join Date
    02-05-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    365
    Posts
    87

    Help finding a tutorial/guide for searching VBA Arrays

    Hi all,

    I'm looking for a tutorial/guide to help me searching within an array (and then assigning to a variable). I've done a few google searches, but I'm struggling to find what I'm after.


    essentially I have an variant array (1 to 4776, 1 to 22), I want to search it for values, conditionally... for example, imagining it as a table, i'd do "countifs" to find what I need, but I'm not sure how to do that within an array.


    If someone knows of a guide/tutorial, or even the words I need to search this for myself, that would be awesome, but I'm either finding guides on creating arrays, or how to create Array Formula in excel.


    Thanks in advance,

    Tim

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Help finding a tutorial/guide for searching VBA Arrays

    It sounds like you just want For...Next loops to loop through each 'row' of the array - eg

    Please Login or Register  to view this content.
    Rory

  3. #3
    Registered User
    Join Date
    02-05-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    365
    Posts
    87

    Re: Help finding a tutorial/guide for searching VBA Arrays

    Quote Originally Posted by rorya View Post
    It sounds like you just want For...Next loops to loop through each 'row' of the array - eg

    Please Login or Register  to view this content.
    HAHAHA! It's starting to look like I've been overthinking this! Thanks Rorya, I'll give that a go and let you know how I get on!

  4. #4
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Help finding a tutorial/guide for searching VBA Arrays

    as @rorya said 'good old fashioned loops' I have attached the method I have used on numerous occassions.
    rather than find what you want, it works by eliminating what you do not want, it fills the unwanted rows with 'emptiness' then eliminates them leaving an array meeting your requirements.
    The attached file was used to prove that data sorting speed would still be effective with 10years worth of data present, the first 20 rows are the array 'seed' put a figure in N4 (say 50,000) press fill array when filled press sort - this gives the speed it took to produce the 'invoice data' & 'transaction history'
    Hope the approach and code is of some assistance.
    torachan.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-05-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    365
    Posts
    87

    Re: Help finding a tutorial/guide for searching VBA Arrays

    Thanks Torachan, i'll take a look at this!

  6. #6
    Registered User
    Join Date
    02-05-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    365
    Posts
    87

    Re: Help finding a tutorial/guide for searching VBA Arrays

    Right, loops are working fine, no idea why I didn't even consider this! Torachan, I'm not going to get time to look at this during this project, but I've saved the file and wanted to thank you for giving me the suggestion.

+ 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. Searching Arrays - Application.Match or loops?
    By Rezzy777 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 04-28-2021, 07:17 AM
  2. List based Fault finding guide
    By rodgerdooter in forum Excel General
    Replies: 3
    Last Post: 04-20-2020, 09:03 AM
  3. Replies: 1
    Last Post: 11-04-2013, 03:14 AM
  4. [SOLVED] New to arrays-where do I find a good beginners guide to multi dimensional arrays
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-04-2013, 07:44 PM
  5. Searching Arrays on Excel for OS X
    By .Cameron. in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-26-2013, 12:50 PM
  6. [SOLVED] PLEASE HELP! Finding the right formulas to create the perfect TV Guide!
    By rebeccapink in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 01-01-2013, 02:49 PM
  7. Excel/outlook complete guide/tutorial
    By C.j. in forum Excel General
    Replies: 1
    Last Post: 03-21-2012, 02:40 PM

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