0

My worksheet contains rows that have been assigned named ranges. For example, row 10 of sheet(1) has been named "Kumquats". I want to write a function that returns the name of the named range when the row # is passed to it. So the function call would be:

getRowNamedRange(rowNum as integer) as string

and the function would return the string "Kumquats" if passed the number 10.

Any ideas?

Ben Rhys-Lewis
  • 3,118
  • 8
  • 34
  • 45
jmaz
  • 507
  • 3
  • 8
  • 19

1 Answers1

1

So according to the reference supplied by Scott something like the following might do:

Public Function getRowNamedRange(rowNum as integer) as string
    getRowNamedRange = Activesheet.rows(rowNum).Name.Name
End Function
whytheq
  • 34,466
  • 65
  • 172
  • 267