你如何获得一个范围来返回它的名字? [英] How do you get a Range to return its Name?
本文介绍了你如何获得一个范围来返回它的名字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Dim sampleRange as Range
Set sampleRange = Worksheet.Range(Cells(1,1),Cells(1,4)
sampleRange.Name = "Range1"
MsgBox sampleRange.Name
上面的代码将显示范围的实际地址,为什么?
如何获得一个命名范围来返回其名称?
The above code will show the actual address of the range, not the name. Why?
How do I get a named range to return its name?
推荐答案
对于一个范围,Name不是一个字符串,它是一个Name对象,然后您使用Name属性来获取字符串:
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
这篇关于你如何获得一个范围来返回它的名字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文