Indirectly referring to a variable
Hello Tim,
I am not sure it matters but lets say that ShowShoe is Double. I get to a
situation where I figure out what variable I want, and then need to get it.
So I reach a point where I know I want SnowShoe, but I need a way of getting
it. I think something like what you gave me would work fine. I will try it
later.
"Tim Williams" wrote:
Where/how is the variable "SnowShoe" defined ?
If you really want to map data this way then you might use (eg) a
dictionary object
'**********************
dim d as object
set d=createobject("scripting.dictionary")
d.add "SnowShoe", 20
d.add "RainShoe", 10
Msgbox d.Item("Snow" & "Shoe") '20
'**********************
Tim
On May 28, 8:32 am, ZipCurs wrote:
Hello,
This is probably easy ... or impossible, but I cannot figure out how to do
this. I want to assembly a variable name in code, and then get that
variable. Separate parts of my macro tell me my prefix is "Snow" and my
suffix is "Shoe". How to I get the value of "SnowShoe"? I have a lot of
these variables. The following does not work:
VariableIWant="Snow" & "Shoe"
NumberINeed=5+VariableIWant
I ended up with a bunch of If statements. Effective but not too elegant.
Any help would be appreciated. Thank you in advance.
.
|