JenniferMurphy
Well-known Member
- Joined
- Jul 23, 2011
- Messages
- 2,679
- Office Version
- 365
- Platform
- Windows
Suppose I have assigned the name "Average" to the range 12:12 (the entire row 12). If there an expression that I can put in a cell that will return that name?
I couldn't find one, so I wrote a UDF:
This code works if I call it with a literal argument
but I couldn't figure out a way to call it with an argument that means "this row" -- "the row the calling cell is on". This is what I want, but it doesn't work
I couldn't find one, so I wrote a UDF:
VBA Code:
Public Function RangeName(pRange As Range) As String
Dim Pieces() As String
Pieces = Split(pRange.Name.Name, "!")
RangeName = Pieces(1)
End Function
Code:
=RangeName(12:12)
Code:
=RangeName(row():row())