Results 1 to 5 of 5

Thread: HOw To handle large number of variables

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2009
    Posts
    8

    HOw To handle large number of variables

    HI,
    ok here it is. I have collection of variables. now there is a calculation associated with each variable. Each variable in collection has a name too.
    Now what i did is I declared a variable of same name of that of the vaiable in the collection and performed calculation and then updated/assigned the calculated value to the variable in the collection.
    Now problem is that I have to write the same code for each variable in the collection.
    Is there any way to minimize the code?
    Is there any way I can iterate it into a loop?
    Thanx.

  2. #2
    Frenzied Member
    Join Date
    Aug 2006
    Location
    India, Punjab, Bhatinda
    Posts
    1,689

    Re: HOw To handle large number of variables

    How about using arrays. The values they store can be accessed by their index

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2009
    Posts
    8

    Re: HOw To handle large number of variables

    but is ther a way to map these variables........
    I am mean each variable has different calculation... that is mandatory , unavoidable , if store the results in an array, then how to map it to that array....

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

    Re: HOw To handle large number of variables

    you can loop through a collection using for each
    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

  5. #5
    Frenzied Member
    Join Date
    Aug 2006
    Location
    India, Punjab, Bhatinda
    Posts
    1,689

    Re: HOw To handle large number of variables

    Not clear.
    can you post some code snippets of what you are doing, so that some one can get some idea.

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