+ Reply to Thread
Results 1 to 2 of 2

Dynamically naming variables

  1. #1
    Forum Contributor
    Join Date
    03-19-2010
    Location
    Calgary, Canada
    MS-Off Ver
    Office 2013, Office 365 Pro Plus
    Posts
    182

    Dynamically naming variables

    Hi,

    I thought I had finished writing my macro, and was actually quite proud of what I had achieved. However, on showing it to my manager he wants me to develop it further (which somewhat ruined my day!), and I need some help.

    The background is that we have some experimental equipment that outputs data, as a comma seperated text string, which is then saved in a huge text file. The equipment that each reading is sent from is denoted by an 'Instrument Code'. These may be different for different text files.

    What I am proposing is to set the macro file up as shown in the attached image (I haven't uploaded a workbook as I haven't any code yet, I'm still at the design stage!), where any number of instrument codes can be specified. The variables held in each string are denoted by the 'data order columns'. you can see in this example 4 different instruments output data of the same form.

    My plan is to read each data string, find it's instrument code and save the data to the related array. However, these arrays would need to be dynamically named based on the number of instrument strings. Is it possible to name an array by the last two characters in a string (or in fact any other means)?

    Many thanks
    Attached Images Attached Images
    Last edited by jlt199; 05-07-2010 at 01:51 PM.

  2. #2
    Forum Contributor
    Join Date
    03-19-2010
    Location
    Calgary, Canada
    MS-Off Ver
    Office 2013, Office 365 Pro Plus
    Posts
    182

    Re: Dynamically naming variables

    Is what I'm proposing even possible? For example, if I have the string "Harry" in cell J4, can I read that string and use it to create an array named "Harry"?

+ 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