LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Dynamic Variable Name

I have a whole slew of variables that are similarly named:

for example

abcdMax = 10
efghMax = 20
ijklMax = 30 ...

I want to use the "Max" variable in a function based upon a string
that is sent to the function

The following code will not work, but I think it illustrates what I am
trying to do....


Function myFunction(incomingstring as String)

fourletters = Left(incomingstring, 4)

dynamicvariable = fourletters & "Max"

myFunction = Dateadd("m", dynamicvariable, "00:00")

End Function


In this code "dynamicvariable" is a string, whereas I want the value
of the variable with the same "name" as this string. I understand
that I could handle my task with a very long case statement, but I am
searching for more brevity. Any and all creative solutions are
appreciated!


Thanks,
Jake
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to replace one dynamic variable with another dynamic variable djreason Excel Worksheet Functions 8 September 11th 09 01:57 AM
Dynamic scenarios - more than 2 variable using data tables in Exc Varghese Excel Discussion (Misc queries) 0 August 7th 06 03:16 PM
dynamic summed range based on a variable Bruce Excel Worksheet Functions 3 November 8th 05 02:45 AM
Refreshing a dynamic range variable Gromit Excel Programming 3 December 3rd 03 08:28 PM
Create dynamic variable names? J Kruger Excel Programming 4 November 27th 03 09:41 PM


All times are GMT +1. The time now is 06:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"