ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   value of value of a variable. (https://www.excelbanter.com/excel-programming/442726-value-value-variable.html)

Joe[_46_]

value of value of a variable.
 
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

Paul Robinson

value of value of a variable.
 
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
On May 21, 12:35*pm, Joe wrote:
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



Joe[_46_]

value of value of a variable.
 
On May 21, 4:43*pm, Paul Robinson
wrote:
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
On May 21, 12:35*pm, Joe wrote:

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


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?

Rick Rothstein

value of value of a variable.
 
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

--
Rick (MVP - Excel)



"Joe" wrote in message
...
On May 21, 4:43 pm, Paul Robinson
wrote:
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
On May 21, 12:35 pm, Joe wrote:

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


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?




All times are GMT +1. The time now is 04:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com