+ Reply to Thread
Results 1 to 3 of 3

How to refer to named variables stored as a string

  1. #1
    Registered User
    Join Date
    04-18-2009
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    40

    How to refer to named variables stored as a string

    Hi,

    I have a small piece of code that has a number of globally declared variables that end in consecutive numbers eg GlobalVariable1, Global Variable 2 etc and have declared them as strings that I want to write text in.

    At the moment, I don't know how to reference the global variable(i) as the macro only seems to write the text to the TempGlobalVariable.

    Any suggestions are greatly appreciated. I have attached the code I currently have below.
    Many Thanks,
    twills

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    03-01-2010
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003
    Posts
    57

    Re: How to refer to named variables stored as a string

    I think what you need is an array for this to work. Got the following tutorial sample from another site:

    Please Login or Register  to view this content.

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,358

    Re: How to refer to named variables stored as a string

    This question gave me pause, asking myself when you might want such a changing global. I remembered those old programming classes talking about Scope of variables and how you might need the topic.

    Searching the net gave a site that may help with your questing and answer. Look at:the following link about Global Variables.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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