+ Reply to Thread
Results 1 to 5 of 5

Loop through custom variables

  1. #1
    Registered User
    Join Date
    10-10-2008
    Location
    Illinois
    MS-Off Ver
    Microsoft Office Excel 2003
    Posts
    85

    Loop through custom variables

    Hello all I have a question and it is hard to explain. I have multiple variables that start with "HrIn" and then a number ex HrIn1, HrIn2.....etc.
    What i am trying to do is use them in a similar way to the
    Me.Controls("Control" & Variable) = XX where i can use the Variable to determine which control I am referring to and that control would = whatever "XX" is.
    SO I thought it would look something like:
    HrIn(Var) = XX where "Var" is a variable that is set to a specific number.
    This does not work and I am running out of ideas.
    I am including the code i am working to maybe help with my explanation.
    Thanks

    Please Login or Register  to view this content.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Loop through custom variables

    You could use a dictionary, where the Key is the variable name and the Item is the value. See VBE Help for Dictionary Object.

    BTW, in your declaration, everything except oddFrame is declared as a Variant.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    10-10-2008
    Location
    Illinois
    MS-Off Ver
    Microsoft Office Excel 2003
    Posts
    85

    Re: Loop through custom variables

    Thank you for the quick reply!!!
    I am trying to figure out the Dictionary Object but i dont quite understand it. Ill keep trying.
    On the variants, I did not include everything.
    Thanks again

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Loop through custom variables

    Please Login or Register  to view this content.
    a and b are variants
    Please Login or Register  to view this content.
    all are longs.

  5. #5
    Registered User
    Join Date
    10-10-2008
    Location
    Illinois
    MS-Off Ver
    Microsoft Office Excel 2003
    Posts
    85

    Re: Loop through custom variables

    I see what you mean now. I did not know that. I thought the way I have them was correct. Thank you

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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