JenniferMurphy
Well-known Member
- Joined
- Jul 23, 2011
- Messages
- 2,691
- Office Version
- 365
- Platform
- Windows
I am trying to obtain the name of a named range passed to a UDF. I want to use it in error messages.
Based on previous discussions and an Internet search, I came up with this, which doesn't work.
I also tried
What is the correct code?
Thanks
Based on previous discussions and an Internet search, I came up with this, which doesn't work.
Code:
Public Function ShowRangeName(rng As Range)
Dim rngname As String
rngname = rng.Name.Name
MsgBox "The name of this range is '" & rngname & "'"
End Function
I also tried
Code:
rngname = rng.Names.Name
rngname = rng.Name
What is the correct code?
Thanks