Results 1 to 3 of 3

Thread: Using Arrays to validate code combinations and retrieve category, dynamically

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2013
    Posts
    3

    Using Arrays to validate code combinations and retrieve category, dynamically

    I am posting on VB Forums to hear some ideas or a "best practices" approach to complete our objective. Please see attachment for further visual understanding and “In Development” macro.

    Background:
    We have three list of codes that when combined should equal one category. The list of codes are currently on three different sheets with the category listed as the header. The codes change periodically and we need a non-excel wiz to be able to manage the codes (but the current approach isn’t necessary) Please see attachement for further visual understanding and beg

    Objective:
    A macro that can retrieve the correct category based on these codes.

    Requirements/Notes:
    All code are always used. Codes for some categories are shared on one list and unique on another list. All combinations should be unique and therefore equal one category
    The macro must be dynamic, as codes could be added & deleted.

    Current Idea:
    I am thinking about creating a series of arrays by category & code(s). Then using an IsInArray function coupled with some IfThen constructs to identify the Category. Ideally, I’d like to use an “Intersect” function to determine the category as I think this will yield a faster runtime.

    Kles

    example.zip

  2. #2
    Hyperactive Member
    Join Date
    May 2006
    Posts
    365

    Re: Using Arrays to validate code combinations and retrieve category, dynamically

    Hello Kles,

    Please do not take offense but I doubt anybody will open the file attached as the security risk in opening an unsigned xlsm is too high to justify. Can you please paste your code and images of the worksheets.

    Kind regards

    Steve

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

    Re: Using Arrays to validate code combinations and retrieve category, dynamically

    whilst i would be prepared to open the file i can only open .xls as my version of excel is too old for these new files
    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

Tags for this Thread

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