#NAME error for user defined functions at workbook startup

R

raul_madrigal

For some reason, we keep getting an occassional #NAME error in cells
that contain the user defined function 'rowheight()' created by the
code shown below when we open the workbook in which it resides. It is
important to note that the workbook is a shared workbook. However, the
problem can then be easily corrected by simply pressing F2 on any one
of the #NAME cells and then pressing <Enter>. Then excel recognizes
the UDF. But why doesn't it recognize it when we open the workbook,
and what can I do to correct the problem?

Thanks for your help...

Code:
Function rowheight(rng As Range)
Application.Volatile
rowheight = rng.Areas(1).Cells(1, 1).rowheight
End Function

*The code sits alone in Module 1 of the workbook. All other macros are
in Module 2. This is the only UDF in the workbook.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top