value of value of a variable.

  • Thread starter Thread starter Joe
  • Start date Start date
J

Joe

I tried searching, but no use!

I have a Const NameA = "BLA BLA"
I have a variable NameB

Value of NameB is NameA.
How do i get the text "BLA BLA" from NameB variable

Is there anyway to do that?

something like,, VALUE(NameB)

Thanks & Regards
Joe
 
Hi
Dim NameB as String
NameB = NameA

in a cell you could have
range("A1").Value = NameB

would now have content "BLA BLA"

regards
Paul
 
Hi
Dim NameB as String
NameB = NameA

in a cell you could have
range("A1").Value = NameB

would now have content "BLA BLA"

regards
Paul

Thanks Paul for the reply.

But in my case there is a difference

Its not NameB = NameA
its rather NameB= "NameA"


is there a way out?
 
I don't think you can do what you are trying to do, at least not with Const
statements and variables. I'm guessing you will have more constants than
NameA, so you might want to consider using a Collection. Consider the
following...

Dim Coll As New Collection
Dim GetNamesText As String
'....
'....
Coll.Add "BLA BLA", "NameA"
Coll.Add "YEAH YEAH", "NameB"
Coll.Add "UH HUH", "NameC"
'....
'....
GetNamesText = Coll("NameA")
MsgBox GetNamesText
GetNamesText = Coll("NameB")
MsgBox GetNamesText
GetNamesText = Coll("NameC")
MsgBox GetNamesText
 
Back
Top