ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   #NAME error for user defined functions at workbook startup (https://www.excelbanter.com/excel-programming/378556-name-error-user-defined-functions-workbook-startup.html)

[email protected]

#NAME error for user defined functions at workbook startup
 
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.



All times are GMT +1. The time now is 12:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com