Variables stored in Range Names 
Author Message
 Variables stored in Range Names

Hi

If I store a variable in a range name, how should I get the variable out.
See the snippet below. I have ended up using the mid() function to strip the
"=" out. What should I have done?

Thanks

Tim

Sub Macro1()
Dim x
ActiveWorkbook.Names.Add Name:="test", RefersToR1C1:="=200.56"
Range("A1") = Names("test")
x = Names("test").Value
MsgBox x
End Sub



Tue, 29 Jun 2004 08:51:59 GMT  
 Variables stored in Range Names
Hi Tim:

x = Evaluate(Names("test").Value)
--
Regards,

Vasant.


Quote:
> Hi

> If I store a variable in a range name, how should I get the variable out.
> See the snippet below. I have ended up using the mid() function to strip
the
> "=" out. What should I have done?

> Thanks

> Tim

> Sub Macro1()
> Dim x
> ActiveWorkbook.Names.Add Name:="test", RefersToR1C1:="=200.56"
> Range("A1") = Names("test")
> x = Names("test").Value
> MsgBox x
> End Sub



Tue, 29 Jun 2004 09:13:53 GMT  
 Variables stored in Range Names
Vasant

Thanks once again for the help.

Tim



Tue, 29 Jun 2004 10:37:56 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Referencing a variable name stored in a variable

2. Assigning a Range Name to a variable range

3. Copy data in a named range to variable range area

4. Delete variable range w/o deleting named range

5. Range name syntax for variable range.

6. Error when checking a variable against a Range when variable value not in the range

7. Store the active worksheet(name) into variable

8. Setting a control who's name is stored in a variable

9. accessing control name stored in a variable

10. Storing subform name in variable when clicked


 
Powered by phpBB® Forum Software © phpBB Group