PDA

Click to See Complete Forum and Search --> : Indirection in VB


KingStu
Dec 8th, 1999, 05:21 AM
How do I reference a variable indirectly? Is there a way to do something like this:

var=Inputbox("Enter the variable to display")
'imagine that "x" was entered"
print ? '{the value of the variable named x)

MartinLiss
Dec 8th, 1999, 06:06 AM
The only way I can think of to do it is:
Select Case var
Case "x"
Print x
Case "y"
Print y
Case "z"
Print z
Case Else
MsgBox "Variable " & var & " not defined"
End Select

------------------
Marty

[This message has been edited by MartinLiss (edited 12-08-1999).]