tags:

views:

39

answers:

1
Dim sampleRange as Range
Set sampleRange = Worksheet.Range(Cells(1,1),Cells(1,4)
sampleRange.Name = "Range1"
MsgBox sampleRange.Nname

This will show the actual address of the range, not the name. Why?
How do I get a named range to return its name?

+3  A: 

For a Range, Name isn't a string it's a Name object, that you then take the Name property of to get the string:

MsgBox sampleRange.Name.Name
Lance Roberts
Thanks, Lance! I searched the Internet long and hard and couldn't find that answer.
GenericJam