How do you get a Range to return its Name?

后端 未结 2 391
无人及你
无人及你 2020-11-27 07:29
Dim sampleRange as Range
Set sampleRange = Worksheet.Range(Cells(1,1),Cells(1,4)
sampleRange.Name = \"Range1\"
MsgBox sampleRange.Name

The above co

2条回答
  •  孤独总比滥情好
    2020-11-27 08:06

    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
    

提交回复
热议问题