View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
H.G. Lamy H.G. Lamy is offline
external usenet poster
 
Posts: 48
Default RefEdit in UDF ?

Hello,

I often use this simple UDF:

Public Function RANDNAME(ElementList)
Application.Volatile (True)
RANDNAME = WorksheetFunction.Index(ElementList, (Rnd() *
WorksheetFunction.CountA(ElementList)) + 1)
End Function

which provides a random text element from a list (named range). It works
fine.

However, I always have to manually type the name of the element list (named
range) into the function's argument panel.

I would much prefer to point to a cell address which already contains that
name.

How could I possibly adapt the above UDF, so that a cell with the element
list's name would suffice ?

Thank you in advance.

Kind regards,

H.G. Lamy