Thread
:
Assigning a constant to a range name
View Single Post
#
2
Posted to microsoft.public.excel.programming
Don Guillett
external usenet poster
Posts: 10,124
Assigning a constant to a range name
IF??? you want to name cell a1 then
Sub namerng()
Range("a1").Name = "i"
'Range("i").Select
MsgBox Range("i")
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Al" wrote in message
...
In XL2003 on XP, I want to assign a constant to a range name, but it's not
working the way I expect.
My test case:
Sub test()
Dim i As Single
i = 0.05 'result of some procedure
' Obviously this works
ActiveWorkbook.Names.Add Name:="Rate", RefersToR1C1:="=Names!R1C1"
Range("A1") = i
MsgBox Range("Rate")
' This assigns the value and I can use it on the worksheet, but why can't
I
read it back?
ActiveWorkbook.Names.Add Name:="IntRate", RefersToR1C1:=i
MsgBox Range("IntRate")
End Sub
Can someone explain this?
--
Al C
Reply With Quote
Don Guillett
View Public Profile
Find all posts by Don Guillett