value of value of a variable.

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
 
P

Paul Robinson

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
 
J

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

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?
 
R

Rick Rothstein

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top