+ Reply to Thread
Results 1 to 6 of 6

Define multiple variables with loop

  1. #1
    Forum Contributor
    Join Date
    02-05-2015
    Location
    czech
    MS-Off Ver
    2010
    Posts
    172

    Define multiple variables with loop

    Hello Dear Excel Help

    Is it somehow possible to define multiple variables with loop like follows?

    Please Login or Register  to view this content.
    Last edited by jakopak; 10-29-2016 at 12:40 PM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,820

    Re: Define multiple variables with loop

    I am sorry, but your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    Code Tags now added - thank you!
    Last edited by AliGW; 10-29-2016 at 05:43 PM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor
    Join Date
    02-05-2015
    Location
    czech
    MS-Off Ver
    2010
    Posts
    172

    Re: Define multiple variables with loop

    I hope my post is correct now.

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Define multiple variables with loop

    Thanks for adding the code tags.

    To answer your question, in the OP code you defined the ar to be an array of strings. Every element of that array is a string.
    That can't be changed.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Define multiple variables with loop

    You can't declare variables like that.

    Why don't you just use an array?
    If posting code please use code tags, see here.

  6. #6
    Forum Contributor
    Join Date
    02-05-2015
    Location
    czech
    MS-Off Ver
    2010
    Posts
    172

    Re: Define multiple variables with loop

    Nori, array will do. I just had a glimpse that it would simplify my code elsewhere. Perhaps it wouldn't. Anyway, I just like to have metaprogramming methods in my arsenal.

+ 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. [SOLVED] Define and use Global Variables
    By brainzlp in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 10-01-2015, 12:08 PM
  2. [SOLVED] Multiple Variables in For Each Loop
    By Excel Guy 123 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-16-2014, 11:47 PM
  3. [SOLVED] Define Variables in a For loop
    By chaddug in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-08-2014, 05:39 PM
  4. Using variables to define a range
    By Aelyn in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-27-2011, 04:27 AM
  5. need help to define a range using two variables
    By dschmitt in forum Excel General
    Replies: 1
    Last Post: 03-15-2010, 08:31 PM
  6. need help to define a range using two variables
    By dschmitt in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-15-2010, 08:14 AM
  7. [SOLVED] How do you define variables in excel?
    By BigRon in forum Excel General
    Replies: 6
    Last Post: 04-16-2005, 04:06 PM

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